Merge from vendor branch OPENSSH:
[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 .\" $DragonFly: src/sbin/shutdown/shutdown.8,v 1.3 2006/02/17 19:33:33 swildner Exp $
35 .\"
36 .Dd December 11, 1998
37 .Dt SHUTDOWN 8
38 .Os
39 .Sh NAME
40 .Nm shutdown
41 .Nd "close down the system at a given time"
42 .Sh SYNOPSIS
43 .Nm
44 .Op Fl
45 .Oo
46 .Fl h | Fl p |
47 .Fl r | Fl k
48 .Oc
49 .Oo
50 .Fl o
51 .Op Fl n
52 .Oc
53 .Ar time
54 .Op Ar warning-message ...
55 .Sh DESCRIPTION
56 The
57 .Nm
58 utility provides an automated shutdown procedure for super-users
59 to nicely notify users when the system is shutting down,
60 saving them from system administrators, hackers, and gurus, who
61 would otherwise not bother with such niceties.
62 .Pp
63 The following options are available:
64 .Bl -tag -width indent
65 .It Fl h
66 The system is halted at the specified
67 .Ar time .
68 .It Fl p
69 The system is halted and the power is turned off
70 (hardware support required)
71 at the specified
72 .Ar time .
73 .It Fl r
74 The system is rebooted at the specified
75 .Ar time .
76 .It Fl k
77 Kick everybody off.
78 The
79 .Fl k
80 option
81 does not actually halt the system, but leaves the
82 system multi-user with logins disabled (for all but super-user).
83 .It Fl o
84 If one of the
85 .Fl h ,
86 .Fl p
87 or
88 .Fl r
89 is specified,
90 .Nm
91 will execute
92 .Xr halt 8
93 or
94 .Xr reboot 8
95 instead of sending signal to
96 .Xr init 8 .
97 .It Fl n
98 If the
99 .Fl o
100 is specified, prevent the file system cache from being flushed by passing
101 .Fl n
102 option to
103 .Xr halt 8
104 or
105 .Xr reboot 8 .
106 This option should probably not be used.
107 .It Ar time
108 .Ar Time
109 is the time at which
110 .Nm
111 will bring the system down and
112 may be the word
113 .Ar now
114 (indicating an immediate shutdown) or
115 specify a future time in one of two formats:
116 .Ar +number ,
117 or
118 .Ar yymmddhhmm ,
119 where the year, month, and day may be defaulted
120 to the current system values.  The first form brings the system down in
121 .Ar number
122 minutes and the second at the absolute time specified.
123 .It Ar warning-message
124 Any other arguments comprise the warning message that is broadcast
125 to users currently logged into the system.
126 .It Fl
127 If
128 .Sq Fl
129 is supplied as an option, the warning message is read from the standard
130 input.
131 .El
132 .Pp
133 At intervals, becoming more frequent as apocalypse approaches
134 and starting at ten hours before shutdown, warning messages are displayed
135 on the terminals of all users logged in.  Five minutes before
136 shutdown, or immediately if shutdown is in less than 5 minutes,
137 logins are disabled by creating
138 .Pa /var/run/nologin
139 and copying the
140 warning message there.  If this file exists when a user attempts to
141 log in,
142 .Xr login 1
143 prints its contents and exits.  The file is
144 removed just before
145 .Nm
146 exits.
147 .Pp
148 At shutdown time a message is written to the system log, containing the
149 time of shutdown, the person who initiated the shutdown and the reason.
150 Corresponding signal is then sent to
151 .Xr init 8
152 to respectively halt, reboot or bring the system down to single-user state
153 (depending on the above options).
154 The time of the shutdown and the warning message
155 are placed in
156 .Pa /var/run/nologin
157 and should be used to
158 inform the users about when the system will be back up
159 and why it is going down (or anything else).
160 .Pp
161 A scheduled shutdown can be canceled by killing the
162 .Nm
163 process (a
164 .Dv SIGTERM
165 should suffice).
166 The
167 .Pa /var/run/nologin
168 file that
169 .Nm
170 created will be removed automatically.
171 .Sh FILES
172 .Bl -tag -width /var/run/nologin -compact
173 .It Pa /var/run/nologin
174 tells login not to let anyone log in
175 .El
176 .Sh BACKWARD COMPATIBILITY
177 The hours and minutes in the second time format may be separated by
178 a colon (``:'') for backward compatibility.
179 .Sh SEE ALSO
180 .Xr kill 1 ,
181 .Xr login 1 ,
182 .Xr wall 1 ,
183 .Xr nologin 5 ,
184 .Xr halt 8 ,
185 .Xr init 8 ,
186 .Xr reboot 8
187 .Sh HISTORY
188 The
189 .Nm
190 utility appeared in
191 .Bx 4.0 .