Schedule a shutdown in Ubuntu
How To

Schedule a Shutdown in Ubuntu

Sagar Sharma
Sagar Sharma

Table of Contents

Well, what you can achieve using a terminal can never be put into words as it is all up to your utilization skills.

Even there is a shutdown command to customize the behavior of how you want to power off your machine!

And that's what I'm going to utilize to schedule the shutdown process in my Ubuntu Linux system.

So let's suppose you want to shut down your system within 15 minutes; you'd need to use the given command:

sudo shutdown +15

Quite straight forward process right? Now, let's have a look at the syntax of the shutdown command:

shutdown [options] [time] [message]

Where:

  • [options] Allows you to choose between halting, rebooting, and shutting down your system.
  • [time] is where you have to specify the time to perform the action specified through [option].
  • Using [message], you can send a custom message to all the logged-in users on a Linux machine.

How to Schedule Shutdown in Ubuntu

⚠️
No user can log in once the scheduled time for shutdown is equal to or less than 5 minutes.

The default behavior of the shutdown command will choose minutes if not specified and if executed without specifying the number (of minutes or time), will use 1 minute as the default option.

sudo shutdown

So the user must specify the time otherwise your system will shut down without your knowledge.

Let's suppose I want to shut down my system after 5 minutes so the appropriate command would be:

sudo shutdown +5
💡
You can use the option -r with the shutdown command for restarting Ubuntu server either immediately or on a schedule (with extra options you saw above).

How to Shutdown Ubuntu At a Specific time

The shutdown command also allows users to specify a time to shut down their systems in HH:MM (24-hours) format.

So if I want to shut down my system at 8 PM, the command would look something like this:

sudo shutdown 20:00

But if you executed thhumerouse command or you no longer want to make the scheduled shut down effective, use -c option with shutdown command:

sudo shutdown -c

Bonus:

You can use +0 option with the shutdown command to power off your system instantly.

Final Thoughts

You'd find the shutdown utility in every Linux distribution and it does not rely on systemd so warm welcome to geeks also!

I found no issues in executing this command but if you do, let me know in the comments, and I'll try my best to get you a suitable solution.