HowTo: RaspberryPi – Set up automatic daily reboot

Recently I had the problem that my MagicMirror did not work properly after two days at the latest. For some reason, the screen was black and it was not clear at first glance how to fix this problem.
As a temporary solution, only a restart of the RaspberryPI helped.

However, as I did not manage to find the cause of the problem for the following days, I needed a “provisional solution” for the actual time.
Because starting the RaspberryPi every day is annoying – especially if you can automate this process.

As a permanent solution for the time being it helped to automatically restart the RaspberryPi every night.

How to do it and what you have to pay attention to is described in the following article.

Hints for our lovely english readers: Basically, many of the articles on are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section. 
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂

Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance.


Helpful Articles:

Before you start with this article, you should have prepared the RaspberryPi so far that it can be reached via the network and controlled by SSH. This is explained in the following articles:
RaspberryPi – Setting up for Nerdiys!
RaspberryPi – The first configuration
RaspberryPi – Controlling the RaspberryPi via SSH

Required tools:

Required material:

In the following list you will find all the parts you need to implement this article.

Log in via SSH on the RaspberryPi

To get started, you first need to log in to RasPi with SSH on Putty. How to do it is described in the article RaspberryPi - Controlling the RaspberryPi via SSH.

After entering your username and password you can start to enter the first commands.

Set up automatic restart

In order for the RaspberryPi to start automatically at the desired time you have to edit the crontab. The “crontab” is a table (hence the “tab”) in which all cronjobs – that is to say, regularly executed activities – are entered. To view and edit them, just enter the following command:

sudo crontab -e

After entering the command you will be asked by the system which text editor you want to use to edit the crontab file. Here you choose “2.”. Enter a “2” and confirm this with a press on “Enter”.
In the file that opens, use the arrow keys to navigate all the way to the end of the file.

There you enter the following line:

0 2 * * * /sbin/shutdown -r now

You set the time through the information before the actual restart command.

In this case (0 2 * * *), the following command is executed at the zeroth minute and the second hour of each day.
So the following scheme applies:

* * * * *Command
| | | | |
| | | | +—– Weekday (0 – 7) (Sonntag ist 0 und 7)
| | | +——- Month (1 – 12)
| | +——— Day (1 – 31)
| +———– Hour (0 – 23)
+————- Minute (0 – 59)

The command to reboot at five o’clock in the morning would be: 0 5 * * */sbin/shutdown -r now
The command to reboot at 1:30 am: 30 1 * * * /sbin/shutdown -r now

This is how the crontab looks with a registered restart command.
Then you save the changes by pressing “CTRL + X” and …
a press on “Enter”.
The changes will then be saved and the RaspberryPi should now be restarted automatically at the specified time.

I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂


P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at

Leave a Reply

Your email address will not be published. Required fields are marked *