SHUTDOWN(8) Linux Programmer's Manual SHUTDOWN(8)
NAME
shutdown(2,8) - close(2,7,n) down the system
SYNOPSIS
shutdown(2,8) [ -h | -r ] [ -fqs ] [ now | hh:ss | +mins ] [ message ]
reboot [ -h | -r ] [ -fqs ] [ now | hh:ss | +mins ] [ message ]
fastboot [ -h | -r ] [ -fqs ] [ now | hh:ss | +mins ] [ message ]
halt [ -h | -r ] [ -fqs ] [ now | hh:ss | +mins ] [ message ]
fasthalt [ -h | -r ] [ -fqs ] [ now | hh:ss | +mins ] [ message ]
DESCRIPTION
In general, shutdown(2,8) prepares the system for a power down or reboot. A
absolute or delta time(1,2,n) can be given, and periodic messages will be sent
to all users(1,5) warning of the shutdown. If no message is specified on the
command line, shutdown(2,8) will ask for a message to be sent, unless the -q
option is set.
halt is the same as shutdown(2,8) -h -q now
fasthalt is the same as shutdown(2,8) -h -q -f now
reboot is the same as shutdown(2,8) -r -q now
fastboot is the same as shutdown(2,8) -r -q -f now
The default delta time(1,2,n), if(3,n) none is specified, is 2 minutes.
Five minutes before shutdown(2,8) (or immediately, if(3,n) shutdown(2,8) is less(1,3) than
five minutes away), the /etc/nologin file(1,n) is created with a message
stating that the system is going down and that logins are no longer
permitted. The login(1,3,5) (1) program will not allow non-superusers to
login(1,3,5) during this period. A message will be sent to all users(1,5) at this
time.
When the shutdown(2,8) time(1,2,n) arrives, shutdown(2,8) notifies all users(1,5), tells
init(8) not to spawn more getty(8)'s, writes the shutdown(2,8) time(1,2,n) into the
/var/log/wtmp file(1,n), kills all other processes on the system, sync(1,2,8)(2)'s,
unmounts all the disks, sync(1,2,8)(2)'s again, waits for a second, and then
either terminates or reboots the system.
Prior to unmounting all discs, the SIGQUIT signal(2,7) is sent to the init
process, which will in(1,8) turn exec(3,n,1 builtins) shutdown(2,8)(8). This allows for clean
unmounting, even if(3,n) the old inode for the init process was unlinked. If
the current process ID (PID) equals 1, then shutdown(2,8)(8) will pause for-
ever.
OPTIONS
-h Halt the system. Do not reboot. This option is used when pow-
ering down the system.
-r Reboot the system.
-f Fast. When the system is rebooted, the file(1,n) systems will not be
checked. This is arranged by creating /fastboot, which /etc/rc
must detect (and delete).
-q Quiet. This uses a default broadcast message, and does not
prompt the user for one.
-s Reboot in(1,8) single user mode. This is arranged by creating
/etc/singleboot, which simpleinit(8) detects (and deletes).
FILES
/etc/rc
/fastboot
/etc/singleboot
/etc/nologin
/var/log/wtmp
/etc/shutdown.conf
CONFIG
The configuration file(1,n) /etc/shutdown.conf is used to determine the
action to take when halting the machine. The currently supported file(1,n)
format is extremely primitive. The first line must contain two strings
separated by whitespace. The first string(3,n) must be HALT_ACTION and the
second specifies the action you wish to take on halt. The options
allowed are:
halt This will simply halt the system. This is the default behaviour.
Note also that this is the fallback if(3,n) another option fails.
power_off
This will use the kernel power shutdown(2,8) facility. This is usu-
ally only available on machines with Advanced Power Management
(APM).
programname
This specifies a command to run to shut down the power. The
first character must be a "/". Bear in(1,8) mind that this command
will be run with only the root filesystem mounted (and it will
be read-only), and no daemons running.
SEE ALSO
umount(8), login(1,3,5)(1), reboot(2), simpleinit(8), init(8)
BUGS
Unlike the BSD shutdown(2,8), users(1,5) are notified of shutdown(2,8) only once or
twice, instead of many times, and at shorter and shorter intervals as
"apocalypse approaches." Some would construe this as a feature.
AUTHOR
This page documents the version(1,3,5) of shutdown(2,8) originally written by Peter
Orbaek (poe@daimi.aau.dk).
Linux 2.0 2 March 2000 SHUTDOWN(8)