xref: /netbsd-src/sbin/shutdown/shutdown.8 (revision 9fbd88883c38d0c0fbfcbe66d76fe6b0fab3f9de)
1.\"	$NetBSD: shutdown.8,v 1.22 2001/11/16 10:25:51 wiz Exp $
2.\"
3.\" Copyright (c) 1988, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"     @(#)shutdown.8	8.2 (Berkeley) 4/27/95
35.\"
36.Dd January 20, 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 Ddfhknpr
45.Ar time
46.Op Ar message ... | Ar -
47.Sh DESCRIPTION
48.Nm
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
54Available friendlinesses:
55.Bl -tag -width time
56.It Fl d
57.Nm
58will pass the
59.Fl d
60flag to
61.Xr reboot 8
62or
63.Xr halt 8 .
64If neither the
65.Fl h
66or
67.Fl r
68flags are specified, then
69.Fl d
70also implies
71.Fl r .
72.It Fl f
73.Nm
74arranges, in the manner of
75.Xr fastboot 8 ,
76for the file systems
77.Em not to be
78checked on reboot.
79.It Fl h
80The system is halted at the specified
81.Ar time
82when
83.Nm
84execs
85.Xr halt 8 .
86.It Fl k
87Kick everybody off.
88The
89.Fl k
90option
91does not actually halt the system, but leaves the
92system multi-user with logins disabled (for all but super-user).
93.It Fl n
94Prevent the normal
95.Xr sync 2
96before stopping.
97.It Fl p
98The system is powered down at the specified
99.Ar time
100when
101.Nm
102execs
103.Xr halt 8 .
104If the powerdown fails, or the system does not support software powerdown,
105the system will simply halt.
106.It Fl r
107The system is rebooted at the specified
108.Ar time
109when
110.Nm
111execs
112.Xr reboot 8 .
113.It Fl D
114Prevents
115.Nm
116from detaching from the tty with
117.Xr fork 2 /
118.Xr exit 3 .
119.It Ar time
120.Ar Time
121is the time at which
122.Nm
123will bring the system down and
124may be the word
125.Ar now
126or a future time in one of two formats:
127.Ar +number ,
128or
129.Ar [[[[[cc]yy]mm]dd]hh]mm ,
130where the century, year, month, day, and hour may be defaulted
131to the current system values.
132The first form brings the system down
133.Ar number
134minutes from the current time; the second brings the system down at the
135absolute time specified.
136If the century is not specified, it defaults to 1900 for years between 69
137and 99, or 2000 for years between 0 and 68.
138A leading zero in the
139.Dq yy
140value is
141.Em not
142optional.
143.It Ar message ...
144Any other arguments comprise the warning message that is broadcast
145to users currently logged into the system.
146.It Ar -
147If
148.Ar -
149is supplied as the only argument after the time, the warning message is read
150from the standard input.
151.El
152.Pp
153At intervals, becoming more frequent as apocalypse approaches
154and starting at ten hours before shutdown, warning messages are displayed
155on the terminals of all users logged in.
156Five minutes before shutdown, or immediately if shutdown is in less
157than 5 minutes, logins are disabled by creating
158.Pa /etc/nologin
159and copying the warning message there.
160If this file exists when a user attempts to log in,
161.Xr login 1
162prints its contents and exits.
163The file is removed just before
164.Nm
165exits.
166.Pp
167At shutdown time a message is written in the system log, containing the
168time of shutdown, who initiated the shutdown and the reason.
169Next a message is printed announcing the start of the system shutdown hooks.
170Then the shutdown hooks in
171.Pa /etc/rc.shutdown
172are run.
173And a message is printed indicating that they have completed.
174After a short delay a terminate
175signal is then sent to
176.Xr init 8
177to bring the system down to single-user state (depending on above options).
178The time of the shutdown and the warning message are placed in
179.Pa /etc/nologin
180and should be used to inform the users about when the system will
181be back up and why it is going down (or anything else).
182.Sh FILES
183.Bl -tag -width /etc/rc.shutdown -compact
184.It Pa /etc/nologin
185tells
186.Xr login 1
187not to let anyone log in
188.It Pa /fastboot
189tells
190.Xr rc 8
191not to run fsck when rebooting
192.It Pa /etc/rc.shutdown
193System shutdown commands
194.El
195.Sh SEE ALSO
196.Xr login 1 ,
197.Xr wall 1 ,
198.Xr fastboot 8 ,
199.Xr halt 8 ,
200.Xr reboot 8
201.Sh BACKWARD COMPATIBILITY
202The hours and minutes in the second time format may be separated by
203a colon (``:'') for backward compatibility.
204.Sh HISTORY
205The
206.Nm
207command appeared in
208.Bx 4.0 .
209