Forum Discussion

Elvorin's avatar
Elvorin
Contributor
14 years ago

How to restart Agent?

I've installed agents on Redhat Linux boxes. These are remote VMs and I dont have access through UI. So I access these servers through putty SSH. That means I'm installing, starting agents through command prompt only.

If I install with root user, it places two softlinks named 'loadUI-agent.sh' and 'loadUI-agent.command' under '/usr/local/bin' directory, they point to corresponding files under '/opt/eviware/loadUI-Agent-1.5.0/' where the actual agent is installed.

Now, sh file has no option to start/stop/restart. More over it has 'JAVA="jre/bin/java"'. So if I try to run the sh file using this softlink, it says './loadUI-agent.sh: line 43: jre/bin/java: No such file or directory'.
  • May I please get an answer on this? Right now only option I know is to kill all running loadui agent processes and reinstall it. Or invoke same commands as seen by 'ps aux | grep loadui' output.
  • You can restart agents by pressing Ctrl-C and then running the sh-file again.

    Regards

    Henrik
    SmartBear Software
  • SmartBear Support wrote:
    You can restart agents by pressing Ctrl-C and then running their sh-file again.

    Regards

    Henrik
    SmartBear Software


    What do you mean by 'running their sh-file'? Currently I see loadUI-agent.sh is running in 2 processes, one with pure shell, one with nohup. I dont if that sh file also spawns the java process. Is my only option to mimic these two process creation by writting a script or manually executing them in 2 commands?

    If that's my only option, I would say that's a very poor way of implementation. I should just have one script to run with start, stop and restart option, which should create all those background and nohup processes.
  • Elvorin wrote:
    What do you mean by 'running their sh-file'? Currently I see loadUI-agent.sh is running in 2 processes, one with pure shell, one with nohup. I dont if that sh file also spawns the java process. Is my only option to mimic these two process creation by writting a script or manually executing them in 2 commands?

    If that's my only option, I would say that's a very poor way of implementation. I should just have one script to run with start, stop and restart option, which should create all those background and nohup processes.

    Sorry, I don't understand. What I mean is:

    * To start the loadUI agent in Linux, run loadUI-agent.sh.
    * To stop the loadUI agent in Linux, press Ctrl+C in the terminal window in which the loadUI agent opened.

    Regards

    Henrik
  • SmartBear Support wrote:
    Elvorin wrote:
    What do you mean by 'running their sh-file'? Currently I see loadUI-agent.sh is running in 2 processes, one with pure shell, one with nohup. I dont if that sh file also spawns the java process. Is my only option to mimic these two process creation by writting a script or manually executing them in 2 commands?

    If that's my only option, I would say that's a very poor way of implementation. I should just have one script to run with start, stop and restart option, which should create all those background and nohup processes.

    Sorry, I don't understand. What I mean is:

    * To start the loadUI agent in Linux, run loadUI-agent.sh.
    * To stop the loadUI agent in Linux, press Ctrl+C in the terminal window in which the loadUI agent opened.

    Regards

    Henrik


    It doesnt work.

    Following is what i see are running (found by running 'ps aux | grep load') -
    543 21163 0.0 0.0 4488 988 ? S Feb22 0:00 /bin/sh -c nohup "/home/loadui-agent/eviware/loadUI-Agent-1.5.0/loadUI-agent.sh" > /dev/null 2>&1
    543 21164 0.0 0.0 4492 1024 ? S Feb22 0:00 /bin/sh /home/loadui-agent/eviware/loadUI-Agent-1.5.0/loadUI-agent.sh
    543 21168 0.0 12.3 1386000 510072 ? Sl Feb22 0:58 jre/bin/java -Xms128m -Xmx768m -XX:MaxPermSize=128m -cp /home/loadui-agent/eviware/loadUI-Agent-1.5.0:/home/loadui-agent/eviware/loadUI-Agent-1.5.0/lib/* com.eviware.loadui.launcher.LoadUILauncher -Dloadui.instance=agent -nofx


    If I press Ctrl+C and again run the same command (ps aux | grep load), I find the processes still running. So now how do I stop all these processes other than running kill command?
    btw, 543 is 'loadui-agent' user.

    What I was suggesting to have ability to do the following -
    ./loadUI-agent start --starts the agent
    ./loadUI-agent stop --stops the agent
    ./loadUI-agent restart --restarts the agent
  • Hi,

    The loadUI Agent does not run as a daemon, out of the box. This means that when you start it by running just the .sh script, it will run as a foreground process, showing you the output in the terminal. By using the command "loadUI-agent.sh" > /dev/null 2>& or simmilar, you are manually redirecting the output and backgrounding the process. This works for any linux command, but to end the process you will have to use the kill command. There are other tools to help managing process, like dtach or screen, which allow you run a foreground process in the background and later reconnect to it. I would suggest using one of them when running the agent.

    You can also add a request to our feature request forum for the ability to run the agent as a daemon.

    Regards,
    Dain
    SmartBear Software
  • SmartBear Support wrote:
    Hi,

    The loadUI Agent does not run as a daemon, out of the box. This means that when you start it by running just the .sh script, it will run as a foreground process, showing you the output in the terminal. By using the command "loadUI-agent.sh" > /dev/null 2>& or simmilar, you are manually redirecting the output and backgrounding the process. This works for any linux command, but to end the process you will have to use the kill command. There are other tools to help managing process, like dtach or screen, which allow you run a foreground process in the background and later reconnect to it. I would suggest using one of them when running the agent.

    You can also add a request to our feature request forum for the ability to run the agent as a daemon.

    Regards,
    Dain
    SmartBear Software


    Funny you mentioned 'you are manually redirecting the output'. Coz I'm not creating those processes, those were created by the agent software installation steps, when it asks at the end 'Do you wanna start the agent?', and I say yes.
  • Hi,

    Touché, I wasn't aware of that. It seems the installer uses a less than optimal way of starting the process in the background, leaving you with the agent running but no way to stop it (besides using kill). Our bad, sorry about that!

    Anyway, you can run the process in the foreground by simply executing loadUI-agent.sh (and using Ctrl+C to end it). I would use 'kill' first to end the currently running process(es). And if you wish to run loadUI as a daemon, I would suggest using screen or dtach as previously mentioned.

    Regards,
    Dain
    SmartBear Software
  • Thanks for clarifying that. At least now I know all three processes are not required for agent to function.