Edit crontab:
sudo crontab -e
The first time you might have to choose your preferred editor (like nano)
Insert a line like
0 4 * * * /sbin/shutdown -r +5
at the bottom. Explanation:
m h dom mon dow command
minute hour dayOfMonth Month dayOfWeek commandToRun
so the line
0 4 * * * /sbin/shutdown -r +5
would reboot your system every day at 4:05am. (4:00am + 5 minutes)
Ctrl+X, Y, Enter should get you out of crontab (if using nano)
Note: you might have to run crontab -e
as root, because shutdown needs root.