In rhq-agent-update-build.xml, when it launches the new agent, this ant script hangs waiting for the agent process to end - but it shouldn't. It should run rhq-agent-wrapper.sh and when it returns the ant script should exit. We are hitting this: https://issues.apache.org/bugzilla/show_bug.cgi?id=34461 but in addition to needing inputstring="", we also need to worry about the output as well.
After much debugging, stripping down the ant script and agent launcher scripts and testing, I determined that this will correct the problem: In rhq-agent.sh: replace this: eval "$CMD &" with: eval "$CMD > /something/here 2>&1 &"
looks like a better solution might be: in rhq-agent-wrapper.sh: replace this: eval $RHQ_AGENT_START_COMMAND > "${RHQ_AGENT_HOME}/logs/rhq-agent-wrapper.log" 2>&1 with eval "$RHQ_AGENT_START_COMMAND > \"${RHQ_AGENT_HOME}/logs/rhq-agent-w rapper.log\" 2>&1"
fixed the eval statement in rhq-agent-wrapper.sh so it redirects the output properly. also had to use inputstring="" in the update ant script.
to test, do something like this: 1) get an agent update binary distribution (if you have a server, its downloadable at http://localhost:7080/agentupdate/download) - call it "rhq-agent-update-binary.jar" 2) install the agent and launch it at the same time using --install and --launch: "java -jar rhq-agent-update-binary.jar --install --launch=true" 3) The agent should start, but the "java -jar" process should exit as soon as the agent has started up. It should not hang around until you kill the agent. You should see some logs saying the ant process is done and the "java -jar" process should die.
Fixed, rev3509 [jweiss@jweiss jon]$ java -jar agent.jar --install --launch=true====================================== ANT target [(default)] Tue Mar 31 12:33:58 GMT-05:00 2009 ====================================== [header-for-install] [echo] ===== RHQ AGENT INSTALL ===== Installing Agent To: . Version: 1.2.0-SNAPSHOT Build Number: 3509 Jar File: /home/jweiss/jon/agent.jar [install] [echo] Extract the agent distro zip from the agent update binary [install] [unjar] Expanding: /home/jweiss/jon/agent.jar into /home/jweiss/jon [install] [echo] Unzip the agent distro into the new installation directory [install] [unzip] Expanding: /home/jweiss/jon/rhq-enterprise-agent-1.2.0-SNAPSHOT.zip into /home/jweiss/jon [install] [echo] chmod +x on executables under ./rhq-agent [install] [echo] Remove the agent distro zip [install] [delete] Deleting: /home/jweiss/jon/rhq-enterprise-agent-1.2.0-SNAPSHOT.zip [install] [echo] DONE! Agent version 1.2.0-SNAPSHOT (build number=3509) has been installed to . ====================================== ANT target [launch-agent] Tue Mar 31 12:34:00 GMT-05:00 2009 ====================================== [launch-agent-unix] [echo] Launching the agent: /home/jweiss/jon/./rhq-agent/bin/rhq-agent-wrapper.sh [process-exit-code-unix] [echo] Launched Unix agent successfully [jweiss@jweiss jon]$
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1465