Reputation: 5449
I have a shell script, thus:
export PYTHONPATH=/usr/local/lib/python
cd /home/skip/workspace/UAM
for file in *.txt
do
echo $file >>log.fil
/usr/bin/python push.py -s $file
done
return 0
It runs properly from command line. prints each filename to the log file and runs the python push.py command as expected. (It creates a directory and populates it.)
But when I try to run it from cron with this crontab:
3 * * * * /home/skip/workspace/UAM/RunAllTest.sh
I am seeing entries in the log file, but push.py is not run properly. (the directory is not created or populated.)
Any assistance would be welcome.
Upvotes: 3
Views: 2178
Reputation: 5449
Got it. Thanks to the kind assistance of licorna.
What was happening is my "push.py" script was calling another program (pybot aka robot framework) without specifying a fully qualified path.
I changed that from "pybot" to /usr/local/bin/pybot" and all is working.
Upvotes: 1
Reputation: 5870
Check that push.py doesn't need any environment variables that may not be set in crontab context. If it is a user crontab (not a root cron) then it will be executed as if the same user executed that line, but not necessarily into the same environment (like aliases and Path set on initialization files).
Upvotes: 3