shutdown 8 administrator commands nosh
shutdown BSD/System 5 compatibility utility for system shutdown
`shutdown` --verbose --halt -H -h --powercycle -c --poweroff -P -p --reboot -r --kick-off -k --no-wall -g period time message

## Description

`shutdown` shuts down the system, optionally waiting for a period and sending warnings to the terminals of logged-in users before calling system-control 1.

`shutdown` waits for a period, sending warning messages to logged-on user terminals with wall 1, and then chains to the powercycle, poweroff, halt, or reboot subcommands of system-control 1 to instruct the system manager to enact a state change. The default, if no option is specified, is to power off.

No checks are made to see whether the current user has permission to send messages to terminals, or to enact system state changes. The wall 1 and system-control 1 commands are expected to perform all permissions checks.

The warning messages comprise an indication of the impending system state change and how soon it will occur, plus whatever additional message text is supplied as message. They can be disabled with the --no-wall option.

The messages are sent during the period before the scheduled shutdown time, beginning at 86400 seconds beforehand. They are sent at 6-hourly intervals until the final 6 hours, at hourly intervals until the final hour, at 15-minute intervals until the final 15 minutes, at 5-minute intervals until the final 5 minutes, at 1 minute intervals until the final minute, at 15-second intervals until the final 15 seconds, and finally when the scheduled time is reached (or passed).

When to shutdown must be specified either with a command line option or an argument:

- The -g (grace period) command line option specifies when with a relative time. It can be:

  now

    This specifies no delay to shutdown.

  hours:minutes

    Shutdown scheduled for hours × 60 + minutes minutes from now. minutes may be greater than 60; hours may be greater than 24.

  minutes

    Shutdown scheduled for minutes minutes from now.

- time is a time specifier for either a relative or an absolute time. It can be:

  now

    This specifies no delay to shutdown.

  +minutes

    Shutdown scheduled for minutes minutes from now.

  HH:MM

    Shutdown scheduled for HH:MM today. This must be now or in the future; and a valid time. It is an absolute time that is not to be confused with the relative time used with the -g command line option.

    The old BSD `shutdown` command considers this to be a backwards compatibility syntax, which is undocumented in its manual. Because of that, and also because of the potential confusion with the (in contrast, documented by AT&T System 5) grace period syntax, use of this form of absolute time is strongly discouraged.
  CC YY MM DD HH MM

    Shutdown scheduled for the given time, assuming the current century, year, month, and day as necessary. This must be now or in the future.

The final state change request can be disabled with the --kick-off option. Its name derives from the notion that one can perform a partial switch to (the old) "single-user" mode which only logs out interactive users, kicking them off the system, although this mechanism has been superseded now that "single-user" mode no longer exists.

## History and compatibility

### Grace period

The upstart and old BSD `shutdown` commands require that the time to shutdown always be specified, aborting if it is not; others default to 1 minute from now in the absence of any specification.

Both the XENIX and UnixWare, and the upstart, old BSD, and systemd ways of specifying when to shut down are supported. In order to avoid embarrassment resulting from unexpected defaults, explicitly specifying when shutdown should occur is mandatory.

### Warning message intervals

The upstart, old BSD, van SmoorenBerg, XENIX, UnixWare, and systemd `shutdown` commands all have different patterns (from one another) of intervals between warning messages being emitted.

In this `shutdown`, the intervals between warning messages roughly follow the pattern used by the XENIX and UnixWare `shutdown` commands.

### Defaults and the obsolete "single-user" mode

The upstart, old BSD, and van Smoorenberg systems incorporated the notion of shutting down to "single-user" mode, even though (on the BSDs at least) that was not strictly speaking possible as the switch to "multi-user" mode made a one-way change to the kernel secure level. As a consequence, their `shutdown` commands had the following semantics:

- With no options, the default action was to (attempt to) transition to "single-user" mode.

- The -r, -h, and (in the old BSD system) -p options overrode that to select reboot, halt, or poweroff.

  In the upstart and van Smoorenberg systems the -h option was actually halt/poweroff, and would require the -H and -P options to further choose which of halt or poweroff was selected, the default being determined by the capabilities of the operating system and platform (which might not support software power off). In the old BSD system the -h and -p options were just halt and poweroff directly.

There is no "single-user" mode now. Neither system-control 1 nor systemd encompass any such thing, and it was in fact also superseded in the van Smoorenberg system in 1995. Its replacements since the 1990s have been and are the `emergency` and `rescue` targets, described in system-control 1. These are startup targets that are not reachable via shutdown procedures.

As a consequence, poweroff is now the default action and the compatibility behaviour is as follows:

- The -p and -P options are considered to be on by default, and thus have no effect.

- The -r, -h, and -H options select the non-default actions.

UnixWare supported a su command-line argument. This was itself a backwards-compatibility mechanism for the `shutdown` command in XENIX, the UnixWare command having a different syntax involving an -i commmand-line option and "run levels". Neither command-line syntax was provided by the old BSD, van Smoorenberg, upstart, or systemd `shutdown` comands.

Not only is there no "single-user" mode now, run levels have been obsolete in the AT&T Unix world since the 1980s and UnixWare had switched to the Service Access Facility. Therefore, this `shutdown` likewise does not provide this XENIX syntax that translates a then-obsolete thing into something that was also then largely obsolete.

### Command line options from old toolsets and other defunct mechanisms

The `shutdown` commands from old toolsets also variously wrote flag files, directly enacted system state changes, bypassed filesystem unmounts and cache flushes, triggered kernel dumps, and had interactive modes where they asked the initiator what xe wanted to do. The flags for these things are either errors or simply ignored:

-y

  This AT&T System 5 option is an error. It was recommended to use non-interactive mode in AT&T System 5 guides in the 1980s; and `shutdown` commands that outright lacked an interactive mode became common in the 1990s.

-f
-F

  These van Smoorenberg options are errors. Flag files, written to a potentially corrupt or dirty volume, are no longer the way to invoke or to bypass filesystem checks.

-o

  This BSD option is ignored. All system state changes are enacted by process #1, usually running system-manager 1. None are enacted directly.

-n

  This van Smoorenberg and BSD option is an error. It is not permitted to bypass the filesystem cache flush, which is an integral part of the actions taken by system-manager 1 at shutdown. The van Smoorenberg system in fact deprecated this mechanism in the 1990s.

-t

  This van Smoorenberg option is an error. Service termination intervals are not adjustable via the `shutdown` command.

-d

  This OpenBSD option is an error. Kernel dumps not triggerable via the `shutdown` command.

## Author

Jonathan de Boyne Pollard