ssh remote command does not return

后端 未结 2 513
萌比男神i
萌比男神i 2021-01-06 08:11

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

The service is nodeJS and I see express is listening on port ... pr

2条回答
  •  旧时难觅i
    2021-01-06 08:46

    Using ssh -t does not hang, but it terminates the remote process too.

    What works for me is just to run the remote process in background as shown below:

    ssh somehost /path/to/some/script augment1 augment2 &
    

提交回复
热议问题