shutdown

From NetBSD Wiki

Jump to: navigation, search

Contents

Description

The shutdown(8) command can switch off, reboot or halt a machine. It's the preferred command to use on multi-user systems because it nicely warns users that the system will go down, and will disable logins when the system is about to go down (5 minutes in advance). It also runs rc.shutdown, so the system will be shut down in a clean fashion.

The basic syntax is:

# /sbin/shutdown <time>

For example, to power down in 5 minutes, use:

# /sbin/shutdown -p +5

To reboot at 1PM, leaving a message to the users, use:

# /sbin/shutdown -r 1300 "Time to do some maintenance!"

The time syntax is equivalent to that of at, except it doesn't allow for second granularity.

Additionally, there's the keyword NOW to indicate you don't want to wait:

# /sbin/shutdown -p now

When you call shutdown with no arguments except a time, the system will drop to single-user mode:

# /sbin/shutdown now

Canceling shutdown

If you run the command with a time limit, it will print its PID. You can simply kill this process in order to stop the shutdown.

Permissions

The shutdown binary is SUID root, and only executable by people from the operator group (sysadmins).

See also

View source code (Please report any bugs or suggestions here).

Personal tools