Automating tasks in Linux is a pretty straightforward process, mainly because the tool used to do it comes with all Linux distributions. It is called Cron, as we mentioned in an earlier post. Cron allows you to automate all sorts of tasks, including reboots. But if you just need to reboot once at a certain time, “at” might suit you well.
Why would you want to schedule a reboot? Usually, you only need to reboot a Linux server after installing a kernel update. Since you can plan such an update ahead of time, the ideal time to reboot would be when most users are not accessing the server. That time, however, might be when you are asleep.
To use “at”, become root and type “at” followed by the time you want the server to reboot:
# at 4am tuesday
This will start the “at” prompt, where you need to type “reboot”.
Press CTRL+D to save your settings. Now your server will reboot at the specified time.