Running a Python script from crontab

David david at abbottdavid.com
Tue Dec 2 22:15:19 CET 2008


Astley Le Jasper wrote:
>  >> my crontab is:
>>
>> 30 15 * * * cd /home/myusername/src && python myscript.py
I create a file runmyscript.sh and put it in /usr/bin

#!/bin/bash
cd /home/myusername.src
python /path/to/myscript

then chmod a+x /usr/bin/runmyscript.sh

test it
./runmyscript

add it to the crontab
30 15 * * * /usr/bin/runmyscript.sh

-- 
Powered by Gentoo GNU/LINUX
http://www.linuxcrazy.com




More information about the Python-list mailing list