APPGIS APPGIS -4 years ago 195
Python Question

cron python file doesn't work on centos 7

i'm trying to schedule my pythohn script into Centos 7 with cron.
On my script at start i have added this:


and this is my cron file that i have create into folder that contain python file

*/5 * * * * /usr/local/bin/python /home/Documents/SCRAPE_PYTHON/ &>> /home/Desktop/log.txt

i have try to run the script into terminal by chmod +x and works fine.
But whit this configuration when in terminal i set crontab .cron the job doesn't work. The log file set into cron file are not write and script not run. The script could be write some data into db and the db is always empty.
Any help???

Answer Source

Type crontab -e in the shell, this will open the cron editor. Here copy paste the entire command.

*/5 * * * * /usr/local/bin/python /home/Documents/SCRAPE_PYTHON/ &>> /home/Desktop/log.txt

Now press Esc key then type colon :wq! and press Enter key. This will install your cron. Your cron should run every 5 minutes.

If your cron encounters any error, it will be saved in /home/Desktop/log.txt.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download