How To Shutdown Linux With A 15 Minute Delay And Message

How to shutdown Linux from terminal? Ubuntu shutdown shortcut can be used to shutdown Ubuntu from terminal commandline.

How to shutdown Ubuntu from terminal command line. Ubuntu shutdown command examples for using Ubuntu shutdown command immediately or Ubuntu shutdown command with 15 minute delay.

Shutdown Command

The shutdown command brings the system down in a secure way. All logged-in users are notified that the system is going down, and login operations are blocked. It is possible to shut the system down immediately, or after a specified delay.

Shutdown Command Format

shutdown [OPTIONS…] [TIME] [WALL…]
shutdown [-akrhPHfFnc] [-t sec] time [message]

Please note that

  • shutdown – Shutdown the computer.
  • restart – Restart the computer.
  • halt — Stop the computer.
  • poweroff — Stop the computer.
  • reboot — Stop the computer.
  • wall — Sends message to all logged-in users for notification.

The first argument may be a time string (which is usually “now”). Optionally, this may be followed by a wall message to be sent to all logged-in users before going down. The time string may either be in the format “hh:mm” for hour/minutes specifying the time to execute the shutdown at, specified in 24h clock format. Alternatively it may be in the syntax “+m” referring to the specified number of minutes m from now. “now” is an alias for “+0”, i.e. for triggering an immediate shutdown. If no time argument is specified, “+1” is implied. Note that to specify a wall message you must specify a time argument, too.

If the time argument is used, 5 minutes before the system goes down the /run/nologin file is created to ensure that further logins shall not be allowed.

Command Options

-H, –halt : Halt the machine.
-P, –poweroff : Power-off the machine (the default).
-r, –reboot : Reboot the machine.
-h : Equivalent to –poweroff, unless –halt is specified.
-k : Do not halt, power-off, reboot, just write wall message.
–no-wall : Do not send wall message before halt, power-off, reboot.
-c : Cancel a pending shutdown. This may be used cancel the effect of an invocation of shutdown with a time argument that is not “+0” or “now”.

Shutdown Command Example

How to Shutdown System at a Specific Time

You can use time argument with shutdown command to (in two different formats – hh:mm and relative time format +m where m is the number of minutes from now).

The following example will schedule system shutdown at 10 A.M (note that the system clock follows 24 hour format):

sudo shutdown 10:00

To shutdown the system after 10 minutes from the current time (now), use the following command:

sudo shutdown +10

+10 is the minutes after which you want the system to shutdown.

How to Shutdown System Immediately

To shut down the system immediately use +0 or its alias now with shutdown command. Look below for the command usage example:

sudo shutdown +0

or

sudo shutdown now

How to Broadcast a Custom Message for Shutdown

You can broadcast a custom message to let people know that system is going to shutdown.

$ sudo shutdown -h +5 "System will shutdown. Please save your work."

Automatically Schedule Ubuntu System Shutdown

To schedule system shutdown using terminal, use the following command format:

shutdown -h (time in minutes)

If you want to shutdown the system in next 90 minutes, run:

shutdown -90

To cancel shutdown command, type the following command:

shutdown -c

Restart

The shutdown command can be used to restart a system with the r option instead of the h option. Usage is same as before. Just replace the h option with r option.

$ sudo shutdown -r +5 "System will shutdown in 5 minutes. Please save your work."

Original Article