[Tutor] Fwd: Running a script in the background
eryksun at gmail.com
Sun Sep 2 23:04:38 CEST 2012
On Sun, Sep 2, 2012 at 10:06 AM, Walter Prins <wprins at gmail.com> wrote:
> nohup python myscript.py &
> Then you can close the terminal afterwards. "nohup" means"no hangup".
> It tells the system that the python process launched as a result of
> this command should not be terminated when its parent shell is
bash starts a background process in a new group. When you close the
terminal (SIGHUP), the OS won't forward the HUP to this group, but
bash defaults to forwarding it. If you "exit", on the other hand, bash
won't be around to forward anything. To skip forwarding HUP in any
case, just "disown" the process.
If you use nohup, you can avoid creating nohup.out files if you
redirect stdout somewhere such as a log file or /dev/null.
If instead you just "exit" or use "disown", remember to redirect both
stdout and stderr so the program doesn't try to write to a
More information about the Tutor