Many of my RaPi's are configured for a daily reboot to increase reliability. Despite many precautions and care being taken during coding some programs (including mine) suffer from [minor] memory leaks. Whilst these leaks don't cause any immediate issues, if the are run for months/years without restarting they have the potential to bring the system down or compromise functionality/security.

There are a number of different ways to configure cron for a reboot, I have found this method the neatest and cleanest:

Create a file named "mycron" (or whatever your like) in the /etc/cron.d/ folder. 

sudo nano /etc/cron.d/mycron

Paste the following lines in the file:

# m h dom mon dow user command
15  2 * * * root /sbin/shutdown -r now

Save the file with Ctrl-O and then exit with Ctrl-X.

There is no need to reboot or restart cron, the new file will be picked up automatically on the next cron run.
Reboot will occur daily at 2:15AM.

You have no rights to post comments