xref: /freebsd/sbin/shutdown/shutdown.8 (revision 2ad872c5794e4c26fdf6ed219ad3f09ca0d5304a)
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.\"	$Id: shutdown.8,v 1.7 1998/12/11 10:25:55 bde Exp $
34.\"
35.Dd Dec 11, 1998
36.Dt SHUTDOWN 8
37.Os BSD 4
38.Sh NAME
39.Nm shutdown
40.Nd "close down the system at a given time"
41.Sh SYNOPSIS
42.Nm shutdown
43.Op Fl
44.Op Fl hknpr
45.Ar time
46.Op Ar warning-message ...
47.Sh DESCRIPTION
48.Nm Shutdown
49provides an automated shutdown procedure for super-users
50to nicely notify users when the system is shutting down,
51saving them from system administrators, hackers, and gurus, who
52would otherwise not bother with such niceties.
53.Pp
54The following options are available:
55.Bl -tag -width indent
56.It Fl h
57The system is halted at the specified
58.Ar time
59when
60.Nm
61executes
62.Xr halt 8 .
63.It Fl k
64Kick everybody off.
65The
66.Fl k
67option
68does not actually halt the system, but leaves the
69system multi-user with logins disabled (for all but super-user).
70.It Fl n
71Prevent the normal
72.Xr sync 2
73before stopping.
74.It Fl p
75The system will turn the power off after shutdown if it can.
76.It Fl r
77.Nm Shutdown
78executes
79.Xr reboot 8
80at the specified
81.Ar time .
82.It Ar time
83.Ar Time
84is the time at which
85.Nm
86will bring the system down and
87may be the word
88.Ar now
89(indicating an immediate shutdown) or
90specify a future time in one of two formats:
91.Ar +number ,
92or
93.Ar yymmddhhmm ,
94where the year, month, and day may be defaulted
95to the current system values.  The first form brings the system down in
96.Ar number
97minutes and the second at the absolute time specified.
98.It Ar warning-message
99Any other arguments comprise the warning message that is broadcast
100to users currently logged into the system.
101.It Fl
102If
103.Ql Fl
104is supplied as an option, the warning message is read from the standard
105input.
106.El
107.Pp
108At intervals, becoming more frequent as apocalypse approaches
109and starting at ten hours before shutdown, warning messages are displayed
110on the terminals of all users logged in.  Five minutes before
111shutdown, or immediately if shutdown is in less than 5 minutes,
112logins are disabled by creating
113.Pa /etc/nologin
114and copying the
115warning message there.  If this file exists when a user attempts to
116log in,
117.Xr login 1
118prints its contents and exits.  The file is
119removed just before
120.Nm
121exits.
122.Pp
123At shutdown time a message is written in the system log, containing the
124time of shutdown, who initiated the shutdown and the reason.
125A terminate
126signal is then sent to
127.Xr init 8
128to bring the system down to single-user state (depending on above
129options).
130The time of the shutdown and the warning message
131are placed in
132.Pa /etc/nologin
133and should be used to
134inform the users about when the system will be back up
135and why it is going down (or anything else).
136.Sh FILES
137.Bl -tag -width /etc/nologin -compact
138.It Pa /etc/nologin
139tells login not to let anyone log in
140.El
141.Sh SEE ALSO
142.Xr login 1 ,
143.Xr wall 1 ,
144.Xr nologin 5 ,
145.Xr halt 8 ,
146.Xr reboot 8
147.Sh BACKWARD COMPATIBILITY
148The hours and minutes in the second time format may be separated by
149a colon (``:'') for backward compatibility.
150.Sh HISTORY
151The
152.Nm
153command appeared in
154.Bx 4.0 .
155