Name

shutdown — BSD/System 5 compatibility utility for system shutdown

Synopsis

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).

Differences from older shutdown tools

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

The first two require that the time to shutdown always be specified, aborting if it is not; the other three default to 1 minute from now in the absence of any specification.

The upstart, old BSD, and System 5 systems incorporate 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 System 5 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).

Their shutdown also wrote flag files, directly enacted system state changes, bypassed filesystem unmounts and cache flushes, and triggered kernel dumps.

Compatibility behaviour

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

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.

There is no "single-user" mode now. Its replacements are the emergency and rescue targets, described in system-control(1), which 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.

The -d , -n , -f , -F , and -t options from the old toolsets are all errors. The -o option from the old toolsets is ignored. Because:

  • Flag files, written to a potentially corrupt or dirty volume, are no longer the way to invoke filesystem checks.

  • All system state changes are enacted by process #1, usually running system-manager(1). None are enacted directly.

  • 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.

  • Service termination signals and intervals are not adjustable via the shutdown command.

Primary behaviour

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.

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. Note: The old BSD shutdown considers this to be a backwards compatibility syntax.

    [[[[[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.

Author

Jonathan de Boyne Pollard