Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tomcat restart hangs when called remotely via ssh

Status
Not open for further replies.

tharrison

Programmer
Feb 25, 2009
3
The following command hangs for me when run from one server:

ssh remoteserver /etc/init.d/tomcat55 restart

(running as root on one server, attempting to restart tomcat on another using the tomcat init script)

The command on the local server executes, but never returns to the command prompt. Ctrl-C gets me back to the prompt, and tomcat is fine and running on the remote server. ps shows no connection on the remote machine, ps shows the ssh command on the local machine still running.

I can run other similar commands the same way with no problem (e.g. apache2, postgresql, mysql)

I can ssh to "remoteserver" and execute the command there without problems.

I think this may be an issue with ssh -- but this only seems to happen with tomcat. Has anyone seen this?

Both servers are configured identically: Ubuntu hardy, tomcat5.5, openJDK 6.0; I have done apt-get upgrade and everything is up to date.
 
Ok, well I have solved this issue, and just in case you are as unfortunate as I to waste two days of your life on this, here's the problem.

executing a remote command with ssh requires that any child processes have returned a result to the calling process. The tomcat 5.5 script appears not to do this ... somewhere, and thus the ssh command will hang forever.

You can work around this behavior by redirecting the output of the tomcat start script to /dev/null, e.g.

ssh remoteserver '/etc/init.d/tomcat55 restart > /dev/null 2>&1'

This will suppress the output of the restart, but will (for some reason) solve the problem.

Doh!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top