Setting up reboot cron job on Pi

One thing i wanted to do is to restart my Pi once a day. I know Linux normaly runs stable, but i had some issues which made this step necessary.

To do so simply use the following commands...

sudo su

crontab -e

and put...

0 13 * * * reboot

at the end of this file and...

exit

This will restart your Pi at 1300h every day.


An alternative approach, cause sometimes above stuff is not working try to create a script and run this by cron. For example in /home/pi/scripts create restart.sh with...

sudo reboot

...in it. Then...

chmod 755 /home/pi/scripts/restart.sh

crontab -e

and change your previously entered line to..

0 13 * * * /home/pi/scripts/restart.sh

Happy restarting.

 

Edit: At the moment I'm testing sudo shutdown -r 2 istead of sudo reboot. Had some sd-card corruptions after multiple reboots. Don't know if this is changing something but it's worth a try and gives a little bit the chance not to be thrown out immediatly cause Pi will now reboot 2 minutes delayed