crontab on raspberry pi, full path, not relative path, is needed.

profesor發表於2024-09-09
Sources: https://forums.raspberrypi.com/viewtopic.php?t=296993
thanks thagrol, thanks RaTTuS,
you are right.
I get wrong. 10 * * * * reboot -> is not reboot in 10 min. It is next hour at minute 10 reboot

*/10 * * * * reboot -> it is rebbot in 10 min

But instruction reboot it is NOT understand by crontab. Yo have to put:
*/10 * * * * /sbin/reboot

And very important you have to do it in the root crontab as pointed by DougieLawson
sudo crontab -e
and inside crontab:
*/10 * * * * /sbin/reboot

Why? I don't know but it is how it works. In the prompt line, you can write reboot and works but not in crontab

I hope this helps many others
since reboot command must be effectively executed by root account, you have to put this cron job in 'sudo crontab -e'
However, if you just execute a regular command, for example, `wget -cq https://www.economist.com/*.zip`;
just put it in 'crontab -e'
https://crontab.guru/

相關文章