I am using SSH to start a background process on a remote server. This is what I have at the moment:
ssh remote_user@server.com \"nohup process &\"
When using nohup
, make sure you also redirect stdin, stdout and stderr:
ssh user@server 'DISPLAY=:0 nohup xeyes < /dev/null > std.out 2> std.err &'
In this way you will be completely detached from the remote process. Be carefull with using ssh -f user@host...
since that will only put the ssh process in the background on the calling side. You can verify this by running a ps -aux | grep ssh
on the calling machine and this will show you that the ssh call is still active, but just put in the background.
In my example above I use DISPLAY=:0
since xeyes is an X11 program and I want it started on the remote machine.