Drop hurd specific dependency on libc0.3 (>= 2.3.2.ds1-12). It is
[sysvinit.git] / man / shutdown.8
1 '\" -*- coding: UTF-8 -*-
2 .\" Copyright (C) 1998-2003 Miquel van Smoorenburg.
3 .\"
4 .\" This program is free software; you can redistribute it and/or modify
5 .\" it under the terms of the GNU General Public License as published by
6 .\" the Free Software Foundation; either version 2 of the License, or
7 .\" (at your option) any later version.
8 .\"
9 .\" This program is distributed in the hope that it will be useful,
10 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
11 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 .\" GNU General Public License for more details.
13 .\"
14 .\" You should have received a copy of the GNU General Public License
15 .\" along with this program; if not, write to the Free Software
16 .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 .\"
18 .\"{{{}}}
19 .\"{{{ Title
20 .TH SHUTDOWN 8 "November 12, 2003" "" "Linux System Administrator's Manual"
21 .\"}}}
22 .\"{{{ Name
23 .SH NAME
24 shutdown \- bring the system down
25 .\"}}}
26 .\"{{{ Synopsis
27 .SH SYNOPSIS
28 .B /sbin/shutdown
29 .RB [ \-t
30 .IR sec ]
31 .RB [ \-arkhncfFHP ]
32 .I time
33 .RI [ warning-message ]
34 .\"}}}
35 .\"{{{ Description
36 .SH DESCRIPTION
37 \fBshutdown\fP brings the system down in a secure way. All logged-in users are
38 notified that the system is going down, and \fBlogin\fP(1) is blocked.
39 It is possible to shut the system down immediately or after a specified delay.
40 All processes are first notified that the system is going down by the
41 signal \s-2SIGTERM\s0. This gives programs like \fBvi\fP(1)
42 the time to save the file being edited,
43 mail and news processing programs a chance to exit cleanly, etc.
44 \fBshutdown\fP does its job by signalling the \fBinit\fP process,
45 asking it to change the runlevel.
46 Runlevel \fB0\fP is used to halt the system, runlevel \fB6\fP is used
47 to reboot the system, and runlevel \fB1\fP is used to put to system into
48 a state where administrative tasks can be performed; this is the default
49 if neither the \fI-h\fP or \fI-r\fP flag is given to \fBshutdown\fP.
50 To see which actions are taken on halt or reboot see the appropriate
51 entries for these runlevels in the file \fI/etc/inittab\fP.
52 .\"}}}
53 .\"{{{ Options
54 .SH OPTIONS
55 .\"{{{ -a
56 .IP "\fB\-a\fP
57 Use \fB/etc/shutdown.allow\fP.
58 .\"}}}
59 .\"{{{ -t sec
60 .IP "\fB\-t\fP \fIsec\fP"
61 Tell \fBinit\fP(8) to wait \fIsec\fP seconds between sending processes the
62 warning and the kill signal, before changing to another runlevel.
63 .\"}}}
64 .\"{{{ -k
65 .IP \fB\-k\fP
66 Don't really shutdown; only send the warning messages to everybody.
67 .\"}}}
68 .\"{{{ -r
69 .IP \fB\-r\fP
70 Reboot after shutdown.
71 .\"}}}
72 .\"{{{ -h
73 .IP \fB\-h\fP
74 Halt or power off after shutdown.
75 .\"}}}
76 .\"{{{ -H
77 .IP \fB\-H\fP
78 Modifier to the -h flag. Halt action is to halt or drop into boot
79 monitor on systems that support it. Must be used with the -h flag.
80 .\"}}}
81 .\"{{{ -P
82 .IP \fB\-P\fP
83 Halt action is to turn off the power.
84 .\"}}}
85 .\"{{{ -n
86 .IP \fB\-n\fP
87 [DEPRECATED] Don't call \fBinit\fP(8) to do the shutdown but do it ourself.
88 The use of this option is discouraged, and its results are not always what
89 you'd expect.
90 .\"}}}
91 .\"{{{ -f
92 .IP \fB\-f\fP
93 Skip fsck on reboot.
94 .\"}}}
95 .\"{{{ -F
96 .IP \fB\-F\fP
97 Force fsck on reboot.
98 .\"}}}
99 .\"{{{ -c
100 .IP \fB\-c\fP
101 Cancel an already running shutdown. With this option it is of course
102 not possible to give the \fBtime\fP argument, but you can enter a
103 explanatory message on the command line that will be sent to all users.
104 .\"}}}
105 .\"{{{ time
106 .IP \fItime\fP
107 When to shutdown.
108 .\"}}}
109 .\"{{{ warning-message
110 .IP \fIwarning-message\fP
111 Message to send to all users.
112 .\"}}}
113 .PP
114 The \fItime\fP argument can have different formats. First, it can be an
115 absolute time in the format \fIhh:mm\fP, in which \fIhh\fP is the hour
116 (1 or 2 digits) and \fImm\fP is the minute of the hour (in two digits).
117 Second, it can be in the format \fB+\fP\fIm\fP, in which \fIm\fP is the
118 number of minutes to wait. The word \fBnow\fP is an alias for \fB+0\fP.
119 .PP
120 If shutdown is called with a delay, it will create the advisory file
121 .I /etc/nologin
122 which causes programs such as \fIlogin(1)\fP to not allow new user
123 logins. This file is created five minutes before the shutdown sequence
124 starts. Shutdown removes this file if it is stopped before it
125 can signal init (i.e. it is cancelled or something goes wrong).
126 It also removes it before calling init to change the runlevel.
127 .PP
128 The \fB\-f\fP flag means `reboot fast'. This only creates an advisory
129 file \fI/fastboot\fP which can be tested by the system when it comes
130 up again. The boot rc file can test if this file is present, and decide not
131 to run \fBfsck\fP(1) since the system has been shut down in the proper way.
132 After that, the boot process should remove \fI/fastboot\fP.
133 .PP
134 The \fB\-F\fP flag means `force fsck'. This only creates an advisory
135 file \fI/forcefsck\fP which can be tested by the system when it comes
136 up again. The boot rc file can test if this file is present, and decide
137 to run \fBfsck\fP(1) with a special `force' flag so that even properly
138 unmounted file systems get checked.
139 After that, the boot process should remove \fI/forcefsck\fP.
140 .PP
141 The \fB-n\fP flag causes \fBshutdown\fP not to call \fBinit\fP,
142 but to kill all running processes itself.
143 \fBshutdown\fP will then turn off quota, accounting, and swapping
144 and unmount all file systems.
145 .\"}}}
146 .\"{{{ Files
147 .SH ACCESS CONTROL
148 \fBshutdown\fP can be called from \fBinit\fP(8) when the magic keys
149 \fBCTRL-ALT-DEL\fP are pressed, by creating an appropriate entry in
150 \fI/etc/inittab\fP. This means that everyone who has physical access
151 to the console keyboard can shut the system down. To prevent this,
152 \fBshutdown\fP can check to see if an authorized user is logged in on
153 one of the virtual consoles. If \fBshutdown\fP is called with the \fB-a\fP
154 argument (add this to the invocation of shutdown in /etc/inittab),
155 it checks to see if the file \fI/etc/shutdown.allow\fP is present.
156 It then compares the login names in that file with the list of people
157 that are logged in on a virtual console (from \fI/var/run/utmp\fP). Only
158 if one of those authorized users \fBor root\fP is logged in, it will
159 proceed. Otherwise it will write the message
160 .sp 1
161 .nf
162 \fBshutdown: no authorized users logged in\fP
163 .fi
164 .sp 1
165 to the (physical) system console. The format of \fI/etc/shutdown.allow\fP
166 is one user name per line. Empty lines and comment lines (prefixed by a
167 \fB#\fP) are allowed. Currently there is a limit of 32 users in this file.
168 .sp 1
169 Note that if \fI/etc/shutdown.allow\fP is not present, the \fB-a\fP
170 argument is ignored.
171 .SH HALT OR POWEROFF
172 The \fB-H\fP option just sets the \fIinit\fP environment variable
173 \fIINIT_HALT\fP to \fIHALT\fP, and the \fB-P\fP option just sets
174 that variable to \fIPOWEROFF\fP. The shutdown script that calls
175 \fBhalt\fP(8) as the last thing in the shutdown sequence should
176 check these environment variables and call \fBhalt\fP(8) with
177 the right options for these options to actually have any effect.
178 Debian 3.1 (sarge) supports this.
179 .SH FILES
180 .nf
181 /fastboot
182 /etc/inittab
183 /etc/init.d/halt
184 /etc/init.d/reboot
185 /etc/shutdown.allow
186 .fi
187 .\"}}}
188 .SH NOTES
189 A lot of users forget to give the \fItime\fP argument
190 and are then puzzled by the error message \fBshutdown\fP produces. The
191 \fItime\fP argument is mandatory; in 90 percent of all cases this argument
192 will be the word \fBnow\fP.
193 .PP
194 Init can only capture CTRL-ALT-DEL and start shutdown in console mode.
195 If the system is running the X window System, the X server processes
196 all key strokes. Some X11 environments make it possible to capture
197 CTRL-ALT-DEL, but what exactly is done with that event depends on
198 that environment.
199 .PP
200 Shutdown wasn't designed to be run setuid. /etc/shutdown.allow is
201 not used to find out who is executing shutdown, it ONLY checks who
202 is currently logged in on (one of the) console(s).
203 .\"{{{ Author
204 .SH AUTHOR
205 Miquel van Smoorenburg, miquels@cistron.nl
206 .\"}}}
207 .\"{{{ See also
208 .SH "SEE ALSO"
209 .BR fsck (8),
210 .BR init (8),
211 .BR halt (8),
212 .BR poweroff (8),
213 .BR reboot (8)
214 .\"}}}