Ssh + nohup does not work

background-processnohupssh

I'm trying to run a program over SSH that keeps running when I disconnect. This Stack Overflow answer gave me the following command:

nohup sleep 30 > foo.out 2> foo.err < /dev/null &

Unfortunately, it doesn't seem to work. I login (ssh -Y) to a remote bash shell and execute it, disconnect, and come back within 30 seconds, but jobs shows nothing and the foo files also show nothing. Is there any other way I can run background jobs over ssh after I logout?

Best Answer

ssh user@server "echo /usr/run/my/job | at now +1 min"
Related Question