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?
jobs
only shows processes that are descendants of the current shell. Try withps | grep sleep
instead.