1SHUTDOWN(8) Linux System Administrator's Manual SHUTDOWN(8)
2
3
4
6 shutdown - bring the system down
7
9 /sbin/shutdown [-t sec] [-arkhncfFHP] time [warning-message]
10
12 shutdown brings the system down in a secure way. All logged-in users
13 are notified that the system is going down, and login(1) is blocked.
14 It is possible to shut the system down immediately or after a specified
15 delay. All processes are first notified that the system is going down
16 by the signal SIGTERM. This gives programs like vi(1) the time to save
17 the file being edited, mail and news processing programs a chance to
18 exit cleanly, etc. shutdown does its job by signalling the init
19 process, asking it to change the runlevel. Runlevel 0 is used to halt
20 the system, runlevel 6 is used to reboot the system, and runlevel 1 is
21 used to put to system into a state where administrative tasks can be
22 performed; this is the default if neither the -h or -r flag is given to
23 shutdown. To see which actions are taken on halt or reboot see the
24 appropriate entries for these runlevels in the file /etc/inittab.
25
27 -a Use /etc/shutdown.allow.
28
29 -t sec Tell init(8) to wait sec seconds between sending processes the
30 warning and the kill signal, before changing to another run‐
31 level.
32
33 -k Don't really shutdown; only send the warning messages to every‐
34 body.
35
36 -r Reboot after shutdown.
37
38 -h Halt or poweroff after shutdown.
39
40 -H Halt action is to halt or drop into boot monitor on systems that
41 support it.
42
43 -P Halt action is to turn off the power.
44
45 -n [DEPRECATED] Don't call init(8) to do the shutdown but do it
46 ourself. The use of this option is discouraged, and its results
47 are not always what you'd expect.
48
49 -f Skip fsck on reboot.
50
51 -F Force fsck on reboot.
52
53 -c Cancel an already running shutdown. With this option it is of
54 course not possible to give the time argument, but you can enter
55 a explanatory message on the command line that will be sent to
56 all users.
57
58 time When to shutdown.
59
60 warning-message
61 Message to send to all users.
62
63 The time argument can have different formats. First, it can be an
64 absolute time in the format hh:mm, in which hh is the hour (1 or 2 dig‐
65 its) and mm is the minute of the hour (in two digits). Second, it can
66 be in the format +m, in which m is the number of minutes to wait. The
67 word now is an alias for +0.
68
69 If shutdown is called with a delay, it creates the advisory file
70 /etc/nologin which causes programs such as login(1) to not allow new
71 user logins. Shutdown removes this file if it is stopped before it can
72 signal init (i.e. it is cancelled or something goes wrong). It also
73 removes it before calling init to change the runlevel.
74
75 The -f flag means `reboot fast'. This only creates an advisory file
76 /fastboot which can be tested by the system when it comes up again.
77 The boot rc file can test if this file is present, and decide not to
78 run fsck(1) since the system has been shut down in the proper way.
79 After that, the boot process should remove /fastboot.
80
81 The -F flag means `force fsck'. This only creates an advisory file
82 /forcefsck which can be tested by the system when it comes up again.
83 The boot rc file can test if this file is present, and decide to run
84 fsck(1) with a special `force' flag so that even properly unmounted
85 filesystems get checked. After that, the boot process should remove
86 /forcefsck.
87
88 The -n flag causes shutdown not to call init, but to kill all running
89 processes itself. shutdown will then turn off quota, accounting, and
90 swapping and unmount all filesystems.
91
93 shutdown can be called from init(8) when the magic keys CTRL-ALT-DEL
94 are pressed, by creating an appropriate entry in /etc/inittab. This
95 means that everyone who has physical access to the console keyboard can
96 shut the system down. To prevent this, shutdown can check to see if an
97 authorized user is logged in on one of the virtual consoles. If shut‐
98 down is called with the -a argument (add this to the invocation of
99 shutdown in /etc/inittab), it checks to see if the file /etc/shut‐
100 down.allow is present. It then compares the login names in that file
101 with the list of people that are logged in on a virtual console (from
102 /var/run/utmp). Only if one of those authorized users or root is logged
103 in, it will proceed. Otherwise it will write the message
104
105 shutdown: no authorized users logged in
106
107 to the (physical) system console. The format of /etc/shutdown.allow is
108 one user name per line. Empty lines and comment lines (prefixed by a #)
109 are allowed. Currently there is a limit of 32 users in this file.
110
111 Note that if /etc/shutdown.allow is not present, the -a argument is
112 ignored.
113
115 The -H option just sets the init environment variable INIT_HALT to
116 HALT, and the -P option just sets that variable to POWEROFF. The shut‐
117 down script that calls halt(8) as the last thing in the shutdown
118 sequence should check these environment variables and call halt(8) with
119 the right options for these options to actually have any effect.
120 Debian 3.1 (sarge) supports this.
121
123 /fastboot
124 /etc/inittab
125 /etc/init.d/halt
126 /etc/init.d/reboot
127 /etc/shutdown.allow
128
130 A lot of users forget to give the time argument and are then puzzled by
131 the error message shutdown produces. The time argument is mandatory; in
132 90 percent of all cases this argument will be the word now.
133
134 Init can only capture CTRL-ALT-DEL and start shutdown in console mode.
135 If the system is running the X window System, the X server processes
136 all key strokes. Some X11 environments make it possible to capture
137 CTRL-ALT-DEL, but what exactly is done with that event depends on that
138 environment.
139
140 Shutdown wasn't designed to be run setuid. /etc/shutdown.allow is not
141 used to find out who is executing shutdown, it ONLY checks who is cur‐
142 rently logged in on (one of the) console(s).
143
145 Miquel van Smoorenburg, miquels@cistron.nl
146
148 fsck(8), init(8), halt(8), poweroff(8), reboot(8)
149
150
151
152 November 12, 2003 SHUTDOWN(8)