Possible Duplicate:
How do I fork a process that doesn't die when shell exits?

Sometimes I remotely connect to my Ubuntu using NX. I then run some jobs in the background, e.g.:

$ /path/to/script.pl &

However, when I log out, the jobs stop running.

How can I make them continue even after I log out?

link|improve this question

58% accept rate
feedback

closed as exact duplicate by grawity, Majenko, Nifle, studiohack Apr 27 '11 at 19:04

This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.

4 Answers

up vote 2 down vote accepted

I think another alternative would be to use screen.

link|improve this answer
nohup is one option, but screen is a much better solution. +1. – peelman Sep 21 '10 at 2:01
How should i run my script using screen? – David B Sep 21 '10 at 9:56
feedback

The shell kills all processes in its process group when it ends, by sending SIGHUP.

If you run the bash shell, you can type disown to keep it running after you log out. This removes it from the list of processes it will send signals to.

Or you can launch the script with nohup, but then you have to remember this when you run the command. This tells your command to ignore the SIGHUP signal that the shell will send. This will work on any shell.

link|improve this answer
feedback

You can use nohup

nohup /path/to/script.pl &
link|improve this answer
feedback

See "Keep linux scripts running after you have closed a remote shell" for how to do this using the screen command.

link|improve this answer
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.