How to run python script in background after i logout

Benji York benji at benjiyork.com
Sun Jul 24 07:30:45 EDT 2005


Harlin Seritt wrote:
> python script.py &
> 
> It runs fine. When I log off ssh I notice that the script died when I
> logged off. How do I make sure it stays running?

As another reply stated, cron is probably what you really want, but to 
answer your question literally:  you want the "nohup" command (short for 
"no hangup", as in the HUP signal).  You would run it like so:

nohup python script.py &

see "man nohup" and "info coreutils nohup" for more info.
--
Benji York



More information about the Python-list mailing list