Want to get rid of Google Ads, click here.
  • Section Widget

  • Recent Article Comments Widget

    drjf4

    I have picked up a copy of the new book. (Also own a copy of the 6.2 version.) I have started... Go to last post

    New book by Mike Sanders: Service Manager 9 Tailoring Techniques

    drjf4 on 2012-02-03
  • How to kill user or process from JavaScript

    Following JavaScript will kill any user or process.

    Code:
     
    function killProcess(p)
    { 
    var rteReturnValue = new SCDatum(); var rteNames = new SCDatum(); rteNames.push("name"); var rteValues = new SCDatum(); rteValues.setType(8); rteValues=system.functions.insert(rteValues, 0, 1, p); system.functions.rtecall("callrad",
    rteReturnValue, "signal", //RAD app name rteNames, rteValues, false); //false to run in same thread, true to run in new thread
    return true;
    }
    Comments 11 Comments
    1. Etdashou's Avatar
      Where do we put this code. How do you integrate this within Service Manager?

      Thanks.
    1. breno.abreu's Avatar
      Quote Originally Posted by Etdashou View Post
      Where do we put this code. How do you integrate this within Service Manager?

      Thanks.
      This is a javascript function, you can create a new Script in the Script Library and then call this functions from Format Control, Link, Display Options, etc...

      Do this
      1 - Open the System Navigator > Tailoring > ScriptLibrary
      2 - Past Tomy's Code put the name "Common" and click "ADD"

      To test de script create a schedule "Test" and put the code bellow in the JavaScript Tab:
      try{
      system.library.Common.killProcess(p); //where p is the process u want to kill
      }catch (e) {
      print ("Error on Schedule: Test - "+e.toString());
      }

      Let-me know about the results..
    1. oscarferreira1's Avatar
      If this script works it would be great to kill process blocked by agentes like the "sla" still I would need a script to bring the agent back up..

      do you happen to have one?
      thanks
    1. krisman's Avatar
      How to you call this? I mean, the current and flaky kill users process is to put the "k" on the line you want and then click on execute command. Where and how do I call this once its in the system?

      Krisman
    1. oscarferreira1's Avatar
      ok found

      http://www.sc-resources.net/content/...rom-JavaScript

      p is the process.. I'm calling $L.xx=rtecall("callrad", $L.xx, "signal", {"name"}, {"sla"}, false)

      where "sla" is my p(process) but it doesn't die... gives out message "Could not send signal to the session (format.ccal,calc.calculations)" why? what data should I give to "p" for it to work?

      the creation works well..

      Thanks
    1. oscarferreira1's Avatar
      What I have is a schedule that verifies the status to see if the sla is dead and also one to verify if it's blocking a record.. all I do for now is send an sms to warn me so I can manualy start or restart the agentes.

      now i can do this automatically.. yet I can't get the kill process to work.. don't know what data 'p' holds....
    1. oscarferreira1's Avatar
      Quote Originally Posted by oscarferreira1 View Post
      What I have is a schedule that verifies the status to see if the sla is dead and also one to verify if it's blocking a record.. all I do for now is send an sms to warn me so I can manualy start or restart the agentes.

      now i can do this automatically.. yet I can't get the kill process to work.. don't know what data 'p' holds....
      "p" holds the Session ID number {25} no quotes...

      The javascript tommy gives is great if you only have javascript to work with else you can write these lines in RAD:
      - $L.xx=rtecall("callrad", $L.xx, "scheduler.start", {"name"}, {"SLA"}, false);
      "Starts an agente, SLA is type in the info record"
      - $L.xx=rtecall("callrad", $L.xx, "signal", {"name"}, {30}, false);
      "Kills any process given the Session Id"

      Get info from the System Status useing:
      - not index("problem", str(processes("SYSTEM")))>0
      "To see if the problem agente is running as a SYSTEM process"
      - $lockstruct=locks()
      "get a structure of the locks table then loop it to find what you want."

      good luck!
    1. olga.petrishina's Avatar
      The client disconnected, but the session left. How to remove zombie process?
      The process does not receive signals. It is necessary to regularly reboot the server.
    1. glg's Avatar
      Quote Originally Posted by olga.petrishina View Post
      The client disconnected, but the session left. How to remove zombie process?
      The process does not receive signals. It is necessary to regularly reboot the server.
      Do you have sync running?
    1. haluko's Avatar
      No need to reboot the server.
      Zombies live as long as their parents do.
      Find the parent process (ppid) using ps -e or ps -f and kill the parent.
    1. oscarferreira1's Avatar
      is this parent process the thread where the operator logged onto?
      If so this will kill all users in this thread.
      If not... please explain better.

      I here that you can put in the arguments in the sm.ini file that will detect zombie sessions.
      ##Avoiding blocked Clients for Days...
      sessiontimeout:5
      heartbeatinterval:60
  • Google search

    Google
     
  • Support ServiceCenter Resources - Make a donation

    Acceptance Mark