Running a Python script from crontab

Jon Redgrave jredgrave at capisco.com
Tue Dec 2 17:12:33 EST 2008


On Dec 2, 2:35 pm, Astley Le Jasper <Astley.lejas... at gmail.com> wrote:
...

Try using the "screen" utility - change the line in your crontab:
cd /home/myusername/src && python myscript.py
to
cd /home/myusername/src && screen -dmS mypthon python -i myscript.py

then once cron has started your program attach to the console using
>> screen -r mypython

(using python -i leaves you at the python prompt if the script just
terminates)

I email myself and drop into the pdb debugger on an exception, then
use screen to debug the system



More information about the Python-list mailing list