Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to start jetty service from ssh using the command:

ssh -t myhost "sudo /sbin/service jetty6 start"

All works well, service comes up but after the command terminates and the connection closes down, the Jetty service goes down, too. If I log into ssh and do the "service" command manually, all works fine.

I have tried to use the recipe from this answer, that didn't work either.

share|improve this question

2 Answers 2

You try backgrounding the process? Maybe SSH is terminating before the init script finishes. ssh -t myhost "sudo /sbin/service jetty6 start &"

Or, try with nohup, too?

share|improve this answer
    
I really hate these "community" bumps on old questions... -_- –  Aaron Copley Oct 10 '12 at 17:22

Before:

# service jetty status
 * Jetty servlet engine is not running.

Use(localhost:2022 virtual machine hostname):

$ ssh -p 2022 localhost "sudo service jetty start"
 * Starting Jetty servlet engine. jetty
 * Jetty servlet engine started, reachable on http://u1004s01:8080/. jetty
   ...done.
$

Result:

# service jetty status
 * Jetty servlet engine is running with pid 2623, and is reachable on http://:8080/

Command service not need go to the background. Add output command:

ssh myhost "sudo /sbin/service jetty6 start;sleep 60;sudo /sbin/service jetty6 status;ps aux | grep jetty" 
share|improve this answer
    
Yeah, sleep is one of the things I tried (no pun intended). The daemon is up as long as the connection to the host is open. When the ssh command exits, the daemon goes down. Strange, I know :-) Please note that I have to do "ssh -t myhost 'sudo ...'" as without -t sudo won't work, says "sudo: sorry, you must have a tty to run sudo" –  Sasha O Sep 23 '10 at 19:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.