xref: /freebsd/sbin/shutdown/shutdown.8 (revision 193d9e768ba63fcfb187cfd17f461f7d41345048)
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. 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 September 21, 2016
32.Dt SHUTDOWN 8
33.Os
34.Sh NAME
35.Nm shutdown ,
36.Nm poweroff
37.Nd "close down the system at a given time"
38.Sh SYNOPSIS
39.Nm
40.Op Fl
41.Oo
42.Fl h | Fl p |
43.Fl r | Fl k
44.Oc
45.Oo
46.Fl o
47.Op Fl n
48.Oc
49.Ar time
50.Op Ar warning-message ...
51.Nm poweroff
52.Sh DESCRIPTION
53The
54.Nm
55utility provides an automated shutdown procedure for super-users
56to nicely notify users when the system is shutting down,
57saving them from system administrators, hackers, and gurus, who
58would otherwise not bother with such niceties.
59.Pp
60The following options are available:
61.Bl -tag -width indent
62.It Fl h
63The system is halted at the specified
64.Ar time .
65.It Fl p
66The system is halted and the power is turned off
67(hardware support required)
68at the specified
69.Ar time .
70.It Fl r
71The system is rebooted at the specified
72.Ar time .
73.It Fl k
74Kick everybody off.
75The
76.Fl k
77option
78does not actually halt the system, but leaves the
79system multi-user with logins disabled (for all but super-user).
80.It Fl o
81If one of the
82.Fl h ,
83.Fl p
84or
85.Fl r
86options are specified,
87.Nm
88will execute
89.Xr halt 8
90or
91.Xr reboot 8
92instead of sending a signal to
93.Xr init 8 .
94.It Fl n
95If the
96.Fl o
97option is specified, prevent the file system cache from being flushed by passing
98.Fl n
99to
100.Xr halt 8
101or
102.Xr reboot 8 .
103This option should probably not be used.
104.It Ar time
105.Ar Time
106is the time at which
107.Nm
108will bring the system down and
109may be the case-insensitive word
110.Ar now
111(indicating an immediate shutdown) or
112a future time in one of two formats:
113.Ar +number ,
114or
115.Ar yymmddhhmm ,
116where the year, month, and day may be defaulted
117to the current system values.
118The first form brings the system down in
119.Ar number
120minutes and the second at the absolute time specified.
121.Ar +number
122may be specified in units other than minutes by appending the corresponding
123suffix:
124.Dq Li s ,
125.Dq Li sec ,
126.Dq Li m ,
127.Dq Li min .
128.Dq Li h ,
129.Dq Li hour .
130.It Ar warning-message
131Any other arguments comprise the warning message that is broadcast
132to users currently logged into the system.
133.It Fl
134If
135.Sq Fl
136is supplied as an option, the warning message is read from the standard
137input.
138.El
139.Pp
140At intervals, becoming more frequent as apocalypse approaches
141and starting at ten hours before shutdown, warning messages are displayed
142on the terminals of all users logged in.
143Five minutes before
144shutdown, or immediately if shutdown is in less than 5 minutes,
145logins are disabled by creating
146.Pa /var/run/nologin
147and copying the
148warning message there.
149If this file exists when a user attempts to
150log in,
151.Xr login 1
152prints its contents and exits.
153The file is
154removed just before
155.Nm
156exits.
157.Pp
158At shutdown time a message is written to the system log, containing the
159time of shutdown, the person who initiated the shutdown and the reason.
160The corresponding signal is then sent to
161.Xr init 8
162to respectively halt, reboot or bring the system down to single-user state
163(depending on the above options).
164The time of the shutdown and the warning message
165are placed in
166.Pa /var/run/nologin
167and should be used to
168inform the users about when the system will be back up
169and why it is going down (or anything else).
170.Pp
171A scheduled shutdown can be canceled by killing the
172.Nm
173process (a
174.Dv SIGTERM
175should suffice).
176The
177.Pa /var/run/nologin
178file that
179.Nm
180created will be removed automatically.
181.Pp
182When run without options, the
183.Nm
184utility will place the system into single user mode at the
185.Ar time
186specified.
187.Pp
188Calling
189.Dq Nm poweroff
190is equivalent to running:
191.Bd -literal -offset indent
192shutdown -p now
193.Ed
194.Sh FILES
195.Bl -tag -width /var/run/nologin -compact
196.It Pa /var/run/nologin
197tells
198.Xr login 1
199not to let anyone log in
200.El
201.Sh EXAMPLES
202Reboot the system in 30 minutes and display a warning message on the terminals
203of all users currently logged in:
204.Pp
205.Dl # shutdown -r +30 \&"System will reboot\&"
206.Sh COMPATIBILITY
207The hours and minutes in the second time format may be separated by
208a colon (``:'') for backward compatibility.
209.Sh SEE ALSO
210.Xr kill 1 ,
211.Xr login 1 ,
212.Xr wall 1 ,
213.Xr nologin 5 ,
214.Xr halt 8 ,
215.Xr init 8 ,
216.Xr reboot 8
217.Sh HISTORY
218A
219.Nm
220command was originally written by Ian Johnstone for UNSW's modified
221.At "6th Edn" .
222It was modified and then incorporated in
223.Bx 4.1 .
224