In order to setup a chronological repeating task without a for loop that checks every second, you will use cron library installed on most linux distros.
Setups
crontab -e
- https://crontab.guru find the time that you want to repeat.
- Write your task:
* */5 * * * /sbin/shutdown -r now
(will reboot every 5hrs) - After saving, cron will update right away, no extra steps required.
crontab -l
to view saved tasks