How to Schedule a Future Reboot in Ubuntu Using the shutdown Command

Why Schedule a Reboot?

In a server environment or a headless Ubuntu workstation, you often need to install kernel updates or apply heavy system configurations that require a full system restart. However, if you are working during active business hours, restarting the server immediately will disconnect all active users and interrupt database queries. Instead of staying awake until 3:00 AM to manually reboot the machine, you can use the built-in shutdown command in the Linux terminal to schedule an automated reboot for a future time, ensuring minimal downtime for your users.

Using the shutdown -r Command

The shutdown command handles both powering off and restarting the machine. To schedule a restart, you must use the -r (reboot) flag.

  1. Open your Terminal (Ctrl + Alt + T), or connect to your Ubuntu server via SSH.
  2. The syntax requires root privileges, the -r flag, and a time variable. The time variable can be a specific hour and minute (in 24-hour format) or a relative number of minutes from now.

Method A: Reboot at a Specific Time

To schedule the server to reboot at exactly 3:00 AM local time, use the following command:

  1. sudo shutdown -r 03:00
  2. Press Enter and provide your administrator password. The terminal will confirm that the reboot has been scheduled.

Method B: Reboot After a Delay

If you just sent out a warning email to your team and want to give them exactly 45 minutes to save their work before the server bounces, use the + symbol:

  1. sudo shutdown -r +45
  2. Press Enter. The system will count down 45 minutes and then automatically restart.

Adding a Warning Message

It is best practice to broadcast a warning message to any users currently logged into the server via SSH. You can append a custom message to the end of your command in quotes:

  1. sudo shutdown -r +15 "Applying kernel updates. System going down in 15 mins!"

How to Cancel a Scheduled Reboot

If you made a mistake or need to delay the maintenance window, you can easily abort any pending shutdown or reboot command.

  1. Simply run the shutdown command with the -c (cancel) flag:
  2. sudo shutdown -c
  3. The scheduled reboot is instantly canceled, and the server will remain online.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.