Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sbin / shutdown / shutdown.8
1 .\" Copyright (c) 1988, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)shutdown.8  8.2 (Berkeley) 4/27/95
33 .\" $FreeBSD: src/sbin/shutdown/shutdown.8,v 1.12.2.5 2003/02/23 21:17:43 trhodes Exp $
34 .\"
35 .Dd December 11, 1998
36 .Dt SHUTDOWN 8
37 .Os
38 .Sh NAME
39 .Nm shutdown
40 .Nd "close down the system at a given time"
41 .Sh SYNOPSIS
42 .Nm
43 .Op Fl
44 .Oo
45 .Fl h | Fl p |
46 .Fl r | Fl k
47 .Oc
48 .Oo
49 .Fl o
50 .Op Fl n
51 .Oc
52 .Ar time
53 .Op Ar warning-message ...
54 .Sh DESCRIPTION
55 The
56 .Nm
57 utility provides an automated shutdown procedure for super-users
58 to nicely notify users when the system is shutting down,
59 saving them from system administrators, hackers, and gurus, who
60 would otherwise not bother with such niceties.
61 .Pp
62 The following options are available:
63 .Bl -tag -width indent
64 .It Fl h
65 The system is halted at the specified
66 .Ar time .
67 .It Fl p
68 The system is halted and the power is turned off
69 (hardware support required)
70 at the specified
71 .Ar time .
72 .It Fl r
73 The system is rebooted at the specified
74 .Ar time .
75 .It Fl k
76 Kick everybody off.
77 The
78 .Fl k
79 option
80 does not actually halt the system, but leaves the
81 system multi-user with logins disabled (for all but super-user).
82 .It Fl o
83 If one of the
84 .Fl h ,
85 .Fl p
86 or
87 .Fl r
88 is specified,
89 .Nm
90 will execute
91 .Xr halt 8
92 or
93 .Xr reboot 8
94 instead of sending signal to
95 .Xr init 8 .
96 .It Fl n
97 If the
98 .Fl o
99 is specified, prevent the file system cache from being flushed by passing
100 .Fl n
101 option to
102 .Xr halt 8
103 or
104 .Xr reboot 8 .
105 This option should probably not be used.
106 .It Ar time
107 .Ar Time
108 is the time at which
109 .Nm
110 will bring the system down and
111 may be the word
112 .Ar now
113 (indicating an immediate shutdown) or
114 specify a future time in one of two formats:
115 .Ar +number ,
116 or
117 .Ar yymmddhhmm ,
118 where the year, month, and day may be defaulted
119 to the current system values.  The first form brings the system down in
120 .Ar number
121 minutes and the second at the absolute time specified.
122 .It Ar warning-message
123 Any other arguments comprise the warning message that is broadcast
124 to users currently logged into the system.
125 .It Fl
126 If
127 .Sq Fl
128 is supplied as an option, the warning message is read from the standard
129 input.
130 .El
131 .Pp
132 At intervals, becoming more frequent as apocalypse approaches
133 and starting at ten hours before shutdown, warning messages are displayed
134 on the terminals of all users logged in.  Five minutes before
135 shutdown, or immediately if shutdown is in less than 5 minutes,
136 logins are disabled by creating
137 .Pa /var/run/nologin
138 and copying the
139 warning message there.  If this file exists when a user attempts to
140 log in,
141 .Xr login 1
142 prints its contents and exits.  The file is
143 removed just before
144 .Nm
145 exits.
146 .Pp
147 At shutdown time a message is written to the system log, containing the
148 time of shutdown, the person who initiated the shutdown and the reason.
149 Corresponding signal is then sent to
150 .Xr init 8
151 to respectively halt, reboot or bring the system down to single-user state
152 (depending on the above options).
153 The time of the shutdown and the warning message
154 are placed in
155 .Pa /var/run/nologin
156 and should be used to
157 inform the users about when the system will be back up
158 and why it is going down (or anything else).
159 .Pp
160 A scheduled shutdown can be canceled by killing the
161 .Nm
162 process (a
163 .Dv SIGTERM
164 should suffice).
165 The
166 .Pa /var/run/nologin
167 file that
168 .Nm
169 created will be removed automatically.
170 .Sh FILES
171 .Bl -tag -width /var/run/nologin -compact
172 .It Pa /var/run/nologin
173 tells login not to let anyone log in
174 .El
175 .Sh SEE ALSO
176 .Xr kill 1 ,
177 .Xr login 1 ,
178 .Xr wall 1 ,
179 .Xr nologin 5 ,
180 .Xr halt 8 ,
181 .Xr init 8 ,
182 .Xr reboot 8
183 .Sh BACKWARD COMPATIBILITY
184 The hours and minutes in the second time format may be separated by
185 a colon (``:'') for backward compatibility.
186 .Sh HISTORY
187 The
188 .Nm
189 utility appeared in
190 .Bx 4.0 .