xref: /freebsd/sbin/shutdown/shutdown.8 (revision 2be1a816b9ff69588e55be0a84cbe2a31efc0f2f)
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.\" 4. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     @(#)shutdown.8	8.2 (Berkeley) 4/27/95
29.\" $FreeBSD$
30.\"
31.Dd December 11, 1998
32.Dt SHUTDOWN 8
33.Os
34.Sh NAME
35.Nm shutdown
36.Nd "close down the system at a given time"
37.Sh SYNOPSIS
38.Nm
39.Op Fl
40.Oo
41.Fl h | Fl p |
42.Fl r | Fl k
43.Oc
44.Oo
45.Fl o
46.Op Fl n
47.Oc
48.Ar time
49.Op Ar warning-message ...
50.Sh DESCRIPTION
51The
52.Nm
53utility provides an automated shutdown procedure for super-users
54to nicely notify users when the system is shutting down,
55saving them from system administrators, hackers, and gurus, who
56would otherwise not bother with such niceties.
57.Pp
58The following options are available:
59.Bl -tag -width indent
60.It Fl h
61The system is halted at the specified
62.Ar time .
63.It Fl p
64The system is halted and the power is turned off
65(hardware support required)
66at the specified
67.Ar time .
68.It Fl r
69The system is rebooted at the specified
70.Ar time .
71.It Fl k
72Kick everybody off.
73The
74.Fl k
75option
76does not actually halt the system, but leaves the
77system multi-user with logins disabled (for all but super-user).
78.It Fl o
79If one of the
80.Fl h ,
81.Fl p
82or
83.Fl r
84is specified,
85.Nm
86will execute
87.Xr halt 8
88or
89.Xr reboot 8
90instead of sending signal to
91.Xr init 8 .
92.It Fl n
93If the
94.Fl o
95is specified, prevent the file system cache from being flushed by passing
96.Fl n
97option to
98.Xr halt 8
99or
100.Xr reboot 8 .
101This option should probably not be used.
102.It Ar time
103.Ar Time
104is the time at which
105.Nm
106will bring the system down and
107may be the word
108.Ar now
109(indicating an immediate shutdown) or
110specify a future time in one of two formats:
111.Ar +number ,
112or
113.Ar yymmddhhmm ,
114where the year, month, and day may be defaulted
115to the current system values.
116The first form brings the system down in
117.Ar number
118minutes and the second at the absolute time specified.
119.It Ar warning-message
120Any other arguments comprise the warning message that is broadcast
121to users currently logged into the system.
122.It Fl
123If
124.Sq Fl
125is supplied as an option, the warning message is read from the standard
126input.
127.El
128.Pp
129At intervals, becoming more frequent as apocalypse approaches
130and starting at ten hours before shutdown, warning messages are displayed
131on the terminals of all users logged in.
132Five minutes before
133shutdown, or immediately if shutdown is in less than 5 minutes,
134logins are disabled by creating
135.Pa /var/run/nologin
136and copying the
137warning message there.
138If this file exists when a user attempts to
139log in,
140.Xr login 1
141prints its contents and exits.
142The 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 COMPATIBILITY
176The hours and minutes in the second time format may be separated by
177a colon (``:'') for backward compatibility.
178.Sh SEE ALSO
179.Xr kill 1 ,
180.Xr login 1 ,
181.Xr wall 1 ,
182.Xr nologin 5 ,
183.Xr halt 8 ,
184.Xr init 8 ,
185.Xr reboot 8
186.Sh HISTORY
187The
188.Nm
189utility appeared in
190.Bx 4.0 .
191