run python script as a background process in linux

So, you have a server to which you connect remotely, upload a python script and want to run it and logout from the server keeping the program running. If you frequently work with spiders, you surely want to do it. But how to do it? For example if your script's name is script.py, then the command is:

nohup python script.py &

And sometimes you may be interested to see the output is that being generated. Then you should view the nohup.out file! This command can be useful:

tail -f nohup.out

So run the program in background and enjoy your time :-)

Comments

aaron said…
Great tip, thanks!
Unknown said…
Hi,

Can you let me know same functionality in Windows xp/7. I mean
"Run ruby file in the background using Python and get stderr and stout?"
hs_Sarshar said…
Thanks, you saved my time

Popular posts from this blog

lambda magic to find prime numbers

Convert text to ASCII and ASCII to text - Python code

Adjacency Matrix (Graph) in Python