In this example I would like to restart my raspberry pi every night at 12 pm.
For this usage a crontab can be really handy. If you are interested in how to get it working, follow this guide:
Before starting with the crontab, make sure to make a
sudo chmod 755 restart.sh
on your particular script (in my case restart.sh).
The restart.sh script looks like this:
1. View your crontab file.
sudo crontab -e
2.Now comes the point where we can schedule our script:
Put this line at the end of the file.
0 23 * * * <path_to_your_script>/restart.sh
For your understanding:
1.M 2.H 3.D 4.M 5.W 1. M = minute (0 - 59)2. S = hour (0 - 23)3. D = day (1 - 31)4. M = month (1 - 12)5. W=weekday (0 - 7) (Sonntag is represented by 0 and 7)
Thats it, The script will be running every midnight.
If you have any questions about the crontab or any other Pi Topic, feel free to comment.