Raspberry Pi: Scheduling Regular Automatic Reboots
Sometimes, you may need to make your Raspberry Pi automatically reboot regularly, for example, once a day at midnight. To achieve this, we'll use a Unix program called "Cron" that allows for the automatic execution of commands.
Adding a Cron Task:
First, you need to be connected to your Raspberry Pi via SSH. If you're not already connected, please do so.
- Enter the following command: "sudo nano /etc/crontab -e".
This command allows you to edit the file containing the list of tasks.
The lines are structured as follows:
minute hour day month day-of-week user command
So, if you want to perform a Raspberry Pi reboot every day at 1:15 AM, you should add the following line:
15 1 * * * root reboot
You'll notice that we use "*" for fields like "day" to indicate that the task should be executed every day.
Finally, press CTRL + X to exit, then save by pressing the "O" or "Y" key (depending on your system's language).
Categories : Linux, Raspberry Pi
By Guillaume - 04/14/2014 at 01:34 am