I have python program, I want to run it everyday with different variable (on CentOS server):
#!/bin/sh
/usr/bin/python /root/testing/test.py --variables /root/testing/daily/test1.txt
while [ $? != 0 ]
do
sleep 60
/usr/bin/python /root/testing/test.py --variables /root/testing/daily/test1.txt
done
sleep 60
runs, but there is no python in htop and program output is empty.
I changed python to /usr/bin/python because when I searched I found answer that it can fix.
Also before running this python code i have another little one, which just updates old files, that program runs and works very. When I'm running this shell program from terminal entering sh tester.sh it works, problem is only when running from cron.
Also it worked in Ubuntu server. What is wrong? Can cron and shell script work different in CentOS?
Also, my crontab syntax:
22 23 * * * sh /root/testing/cron-work.sh >> /root/cron1.log
23 23 * * * sh /root/testing/cron-work2.sh >> /root/cron2.log
24 23 * * * sh /root/testing/cron-work3.sh >> /root/cron3.log
14 23 * * * sh /root/testing/cron-work4.sh >> /root/cron4.log
2> /tmp/cron_log.txt
(or whatever name you want) to the end of the python command line. That way, you can see if any errors are returned. – terdon Jan 15 '14 at 0:34