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

Shar this article :

Similar articles

How to resolve the Possible attack detected message in ISPConfig ?

If you are managing a web server with ISPConfig, you may encounter the warning message "Possible attack detected. This action has been logged." on the web interface, making access impossible. This alert can be triggered for various reasons, but its resolution is simple. Here's how to resolve...

Postfix : Fixing email sending issues to Gmail due to IPv6

If you are unable to send emails to Gmail addresses from your server and you encounter the following error, it is likely a configuration issue if you have both IPv4 and IPv6: Our system has detected that this message does 550-5.7.1 not meet IPv6 sending guidelines regarding PTR records and...

Automatically Start Node.js on Server Boot

If you've ever created programs using Node.js, you've probably encountered this issue: Node.js scripts don't automatically restart when you reboot your server. Therefore, you need to manually reconnect to restart them, which can be quite inconvenient. Here's a small shell script that allows you to...