简体   繁体   中英

I cant to run my script automatically (cron) Raspberry Pi

I need to run my script time.py every day. I execute crontab -e and add

15 19 * * * pi /usr/bin/python /home/Desktop/miBBDD/time.py

So my script should run every day at 19:15, but it doesn't. If I execute service cron status I can see: active running and my file has permissions for read and write.

Somebody know what is the problem? (My script work fine)

Have you edited the crontab with sudo?

Do a quick test: include a line in the crontab (sudo crontab -e) that calls a test line every minute, for example:

* * * * * logger "Is it working?"

This line will execute every minute and you should see the result of it at /var/log/syslog. If every minute you see a new line "Is it working?" printed out there it means you are working in the right direction and your line at the crontab should work ( remember sudo ).

I had similar issue some time ago. Delete the user part of your crontab file.

15 19 * * * /usr/bin/python /home/Desktop/miBBDD/time.py

Compare with this answear .

EDIT: just one more thing: is the path valid? Shouldn't it be /home/pi/Desktop... ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM