Sometimes you want your server to reboot at a specific time, just once, not on a recurring schedule like with cron
. A neat way to do this on Ubuntu is by using the at
command.
If you haven’t yet installed the at
packe, do so by running sudo apt install at
.
Here’s how it works
Open a terminal and schedule the job with
at
. For example, to reboot at 01:00:sudo at 01:00
.At the
at>
prompt, type the command you want to run:/sbin/shutdown -r now
.End the input with
Ctrl+D
.
That’s it, your reboot is scheduled.
Other things to do with at
Want to check what’s in the queue? Just run sudo atq
and you can see the planned tasks.
Changed your mind and want to cancel the job? Remove it by ID (usually 1
if it’s your first one). Just run sudo atrm 1
and the job is removed.
This is a simple, one-off way to schedule reboots (or any other command) without messing around with cron jobs. For more info about the at
command, check out man at
.