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