How do I run a script in the background and leave it running when I log out? [duplicate]
Solution 1:
You want to use the program screen
. Here is the man page for it, and here is a nice tutorial. It should do exactly what you want it to do - execute something in the background and be able to come back to it later.
Solution 2:
You can use:
nohup /path/to/script >output 2>&1 &
Solution 3:
You could start a screen session, start your job, and the disconnect from the screen session.
Later, you can reattach to your screen session to see if your job has completed.
See also https://serverfault.com/questions/2016/on-a-linux-server-how-do-you-use-multiple-terminals-over-a-single-ssh-connection/2027#2027
Solution 4:
nohup
nohup - run a command immune to hangups, with output to a non-tty
—
man nohup
Solution 5:
With bash:
my_program &
disown -h %1
Alter the number for your actual job number (see jobs
builtin too)