xref: /openbsd-src/sbin/shutdown/shutdown.8 (revision 1105dba72eac676a382118686dc491cc5e949794)
1.\"	$OpenBSD: shutdown.8,v 1.44 2023/06/19 13:05:25 deraadt Exp $
2.\"	$NetBSD: shutdown.8,v 1.6 1995/03/18 15:01:07 cgd Exp $
3.\"
4.\" Copyright (c) 1988, 1991, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)shutdown.8	8.1 (Berkeley) 6/5/93
32.\"
33.Dd $Mdocdate: June 19 2023 $
34.Dt SHUTDOWN 8
35.Os
36.Sh NAME
37.Nm shutdown
38.Nd close down the system at a given time
39.Sh SYNOPSIS
40.Nm shutdown
41.Op Fl
42.Op Fl dfhknpr
43.Ar time
44.Op Ar warning-message ...
45.Sh DESCRIPTION
46.Nm
47provides an automated shutdown procedure for superusers
48to nicely notify users when the system is shutting down,
49saving them from system administrators, hackers, and gurus, who
50would otherwise not bother with such niceties.
51When the
52.Nm
53command is issued without options, the system is placed in single
54user mode at the indicated time after shutting down all system
55services.
56.Pp
57Users in the
58.Va _shutdown
59group can also run the
60.Nm
61command.
62Historically this permission was tied to the
63.Va operator
64group.
65.Pp
66The options are as follows:
67.Bl -tag -width Ds
68.It Fl d
69When used with
70.Fl h ,
71.Fl p ,
72or
73.Fl r
74causes system to perform a dump.
75This option is useful for debugging system dump procedures or capturing the
76state of a corrupted or misbehaving system.
77See
78.Xr savecore 8
79for information on how to recover this dump.
80.It Fl f
81Create the file
82.Pa /fastboot
83so that the file systems will
84.Em not
85be checked by
86.Xr fsck 8
87during the next boot.
88(See
89.Xr rc 8 ) .
90.It Fl h
91The system is halted at the specified
92.Ar time
93when
94.Nm
95execs
96.Xr halt 8 .
97.It Fl k
98Kick everybody off.
99The
100.Fl k
101option
102does not actually halt the system, but leaves the
103system multi-user with logins disabled (for all but superuser).
104.It Fl n
105When used with
106.Fl h ,
107.Fl p ,
108or
109.Fl r
110prevents the normal
111.Xr sync 2
112before stopping the system.
113.It Fl p
114The system is powered down at the specified
115.Ar time .
116The
117.Fl p
118flag is passed on to
119.Xr halt 8 ,
120causing machines which support automatic power down to do so after halting.
121.It Fl r
122.Nm
123execs
124.Xr reboot 8
125at the specified
126.Ar time .
127.It Ar time
128.Ar time
129is the time at which
130.Nm
131will bring the system down and
132may be the word
133.Ar now
134(indicating an immediate shutdown) or
135specify a future time in one of two formats:
136.Ar +number ,
137or
138.Ar yymmddhhmm ,
139where the year, month, and day may be defaulted
140to the current system values.
141The first form brings the system down in
142.Ar number
143minutes and the second at the absolute time specified.
144.It Ar warning-message
145Any other arguments comprise the warning message that is broadcast
146to users currently logged into the system.
147.It Fl
148If
149.Sq Fl
150is supplied as an option, the warning message is read from the standard
151input.
152.El
153.Pp
154At intervals, becoming more frequent as apocalypse approaches
155and starting at ten hours before shutdown, warning messages are displayed
156on the terminals of all users logged in.
157Five minutes before
158shutdown, or immediately if shutdown is in less than 5 minutes,
159logins are disabled by creating
160.Pa /etc/nologin
161and copying the
162warning message there.
163If this file exists when a user attempts to log in,
164.Xr login 1
165prints its contents and exits.
166The file is removed just before
167.Nm
168exits.
169.Pp
170At shutdown time a message is written in the system log, containing the
171time of shutdown, who initiated the shutdown and the reason.
172A terminate
173signal is then sent to
174.Em init
175to bring the system down to single-user state (depending on above
176options).
177The time of the shutdown and the warning message
178are placed in
179.Pa /etc/nologin
180and should be used to
181inform the users about when the system will be back up
182and why it is going down (or anything else).
183.Pp
184You can cancel a scheduled shutdown with the
185.Xr kill 1
186command by killing the shutdown process.
187.Sh FILES
188.Bl -tag -width /etc/rc.shutdown -compact
189.It Pa /etc/nologin
190tells login not to let anyone log in
191.It Pa /etc/rc.shutdown
192run by
193.Xr rc 8
194before the system is shutdown
195.It Pa /fastboot
196tells
197.Xr rc 8
198not to run
199.Xr fsck 8
200during the next boot
201.El
202.Sh SEE ALSO
203.Xr kill 1 ,
204.Xr login 1 ,
205.Xr wall 1 ,
206.Xr halt 8 ,
207.Xr rc.shutdown 8 ,
208.Xr reboot 8
209.Sh STANDARDS
210The hours and minutes in the second time format may be separated by
211a colon
212.Pq Sq \&:
213for backward compatibility.
214.Sh HISTORY
215A
216.Nm
217command first appeared outside of Bell Labs in PWB/UNIX 1.0
218and has been available since
219.Bx 4.1 .
220