xref: /netbsd/sbin/shutdown/shutdown.8 (revision c4a72b64)
1.\"	$NetBSD: shutdown.8,v 1.24 2002/10/18 22:44:42 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 October 18, 2002
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 b Ar bootstr
45.Op Fl Ddfhknpr
46.Ar time
47.Op Ar message ... | Ar -
48.Sh DESCRIPTION
49.Nm
50provides an automated shutdown procedure for super-users
51to nicely notify users when the system is shutting down,
52saving them from system administrators, hackers, and gurus, who
53would otherwise not bother with such niceties.
54.Pp
55Available friendlinesses:
56.Bl -tag -width bootstr
57.It Fl b Ar bootstr
58The given
59.Ar bootstr
60is passed to
61.Xr reboot 8
62for the benefit of those systems that can pass boot arguments to the
63firmware.
64Currently, this only affects sun3 and sparc machines.
65.It Fl d
66.Nm
67will pass the
68.Fl d
69flag to
70.Xr reboot 8
71or
72.Xr halt 8 .
73If neither the
74.Fl h
75or
76.Fl r
77flags are specified, then
78.Fl d
79also implies
80.Fl r .
81.It Fl f
82.Nm
83arranges, in the manner of
84.Xr fastboot 8 ,
85for the file systems
86.Em not to be
87checked on reboot.
88.It Fl h
89The system is halted at the specified
90.Ar time
91when
92.Nm
93execs
94.Xr halt 8 .
95.It Fl k
96Kick everybody off.
97The
98.Fl k
99option
100does not actually halt the system, but leaves the
101system multi-user with logins disabled (for all but super-user).
102.It Fl n
103Prevent the normal
104.Xr sync 2
105before stopping.
106.It Fl p
107The system is powered down at the specified
108.Ar time
109when
110.Nm
111execs
112.Xr halt 8 .
113If the powerdown fails, or the system does not support software powerdown,
114the system will simply halt.
115.It Fl r
116The system is rebooted at the specified
117.Ar time
118when
119.Nm
120execs
121.Xr reboot 8 .
122.It Fl D
123Prevents
124.Nm
125from detaching from the tty with
126.Xr fork 2 /
127.Xr exit 3 .
128.It Ar time
129.Ar Time
130is the time at which
131.Nm
132will bring the system down and
133may be the word
134.Ar now
135or a future time in one of two formats:
136.Ar +number ,
137or
138.Ar [[[[[cc]yy]mm]dd]hh]mm ,
139where the century, year, month, day, and hour may be defaulted
140to the current system values.
141The first form brings the system down
142.Ar number
143minutes from the current time; the second brings the system down at the
144absolute time specified.
145If the century is not specified, it defaults to 1900 for years between 69
146and 99, or 2000 for years between 0 and 68.
147A leading zero in the
148.Dq yy
149value is
150.Em not
151optional.
152.It Ar message ...
153Any other arguments comprise the warning message that is broadcast
154to users currently logged into the system.
155.It Ar -
156If
157.Ar -
158is supplied as the only argument after the time, the warning message is read
159from the standard input.
160.El
161.Pp
162At intervals, becoming more frequent as apocalypse approaches
163and starting at ten hours before shutdown, warning messages are displayed
164on the terminals of all users logged in.
165Five minutes before shutdown, or immediately if shutdown is in less
166than 5 minutes, logins are disabled by creating
167.Pa /etc/nologin
168and copying the warning message there.
169If this file exists when a user attempts to log in,
170.Xr login 1
171prints its contents and exits.
172The file is removed just before
173.Nm
174exits.
175.Pp
176At shutdown time a message is written in the system log, containing the
177time of shutdown, who initiated the shutdown and the reason.
178Next a message is printed announcing the start of the system shutdown hooks.
179Then the shutdown hooks in
180.Pa /etc/rc.shutdown
181are run.
182And a message is printed indicating that they have completed.
183After a short delay a terminate
184signal is then sent to
185.Xr init 8
186to bring the system down to single-user state (depending on above options).
187The time of the shutdown and the warning message are placed in
188.Pa /etc/nologin
189and should be used to inform the users about when the system will
190be back up and why it is going down (or anything else).
191.Sh FILES
192.Bl -tag -width /etc/rc.shutdown -compact
193.It Pa /etc/nologin
194tells
195.Xr login 1
196not to let anyone log in
197.It Pa /fastboot
198tells
199.Xr rc 8
200not to run fsck when rebooting
201.It Pa /etc/rc.shutdown
202System shutdown commands
203.El
204.Sh SEE ALSO
205.Xr login 1 ,
206.Xr wall 1 ,
207.Xr fastboot 8 ,
208.Xr halt 8 ,
209.Xr reboot 8
210.Sh BACKWARD COMPATIBILITY
211The hours and minutes in the second time format may be separated by
212a colon (``:'') for backward compatibility.
213.Sh HISTORY
214The
215.Nm
216command appeared in
217.Bx 4.0 .
218