Description of problem: If as7 is started using the start operation and the agent is shut down, the as7 is killed as well In other words, it doesn't survive the lifecycle of the agent if it was started by the agent. Even though the "Start Script Prefix" property in connection settings of as7 is correctly set to "/usr/bin/nohup" value. Version-Release number of selected component (if applicable): RHQ 4.6.0-SNAPSHOT How reproducible: always Steps to Reproduce: 1. import the as7 to the inventory 2. shut it down and up or restart it using the scheduled operation 3. kill the agent Actual results: the as7 is down Expected results: the as7 is up Additional info: Setting the env. variable LAUNCH_JBOSS_IN_BACKGROUND="true" in the standalone.sh (the default provided launch script for as7) also doesn't help.
Replicated also for as6 (eap 5.1.2). This is happening because of following lines in the launch script (doesn't matter if it is standalone.sh or run.sh): trap "kill -HUP $JBOSS_PID" HUP trap "kill -TERM $JBOSS_PID" INT trap "kill -QUIT $JBOSS_PID" QUIT trap "kill -PIPE $JBOSS_PID" PIPE trap "kill -TERM $JBOSS_PID" TERM i.e. script register itself for listening on the signals mentioned above and re-sends (relays) the signal to the actual jboss process. If these commands are commented out, the life cycle of AS will survive the life cycle of the agent. A quick fix may try to find those traps commands in the launch script and comment them out.
Adding following code to AgentMain.start() method solves the issue: SignalHandler signalHandler = new SignalHandler() { public void handle(Signal signal) { LOG.warn("Catching interrupt signal, shutting down all the threads." m_shutdownHook.run(); } }; Signal.handle(new Signal("INT"), signalHandler); Unfortunately, the classes SignalHandler and Signal are coming from sun.misc package and we can't depend on them. The code make use of native methods so it can't be copy&pasted to our code base.