PDA

View Full Version : Python + crontab



paulfox
July 14th, 2005, 10:58 AM
Hi All,
I've written a program which is in /home/fox/log.py, and i want to execute it at 10:30 am.
The program checks some system statistics like uptime, and creates a log file called system.log, in the directory where the log.py file is.
in my crontab (crontab -e), i have:


30 10 * * * /home/fox/log.py

the python code is executed ok, but the log file isn't created. (it is if i execute it manually though).

Any ideas how to get it working? i've tried writing a bash script:


#!/usr/bin/python /home/fox/log.py

setting it executable, and running that from cron. but i get the same results.

help please! :)

thanks for reading.

badrinarayan
July 14th, 2005, 11:49 AM
I think that the python code uses relative path for the log file and you are unable to locate it. It should work otherwise.

Regards
Badri

LordHunter317
July 14th, 2005, 02:58 PM
To clarify what he said, if you're using a relative path for the script output, it's not being output where you think it is.