Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ssh remote command does not return

Tags:

ssh

I am running ssh somehost "service XXX restart" and the shell hangs.

The service is nodeJS and I see express is listening on port ... print I made in server.js and that's it, it does not return to prompt, it simply hangs.

I tried nohup and & but it does not help. What else can I try?

like image 554
guy mograbi Avatar asked Sep 02 '13 09:09

guy mograbi


1 Answers

turns out that using -t resolves the issue.

ssh -t root@somehost "service XXX restart" does not hang.

other suggestions from the comments that might resolve this:

  • node myScript.js & disown
  • exec node myScript.js &
like image 159
guy mograbi Avatar answered Sep 28 '22 10:09

guy mograbi