xref: /dragonfly/sbin/shutdown/shutdown.8 (revision 1de703da)
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.\" $FreeBSD: src/sbin/shutdown/shutdown.8,v 1.12.2.5 2003/02/23 21:17:43 trhodes Exp $
34.\" $DragonFly: src/sbin/shutdown/shutdown.8,v 1.2 2003/06/17 04:27:34 dillon Exp $
35.\"
36.Dd December 11, 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
45.Oo
46.Fl h | Fl p |
47.Fl r | Fl k
48.Oc
49.Oo
50.Fl o
51.Op Fl n
52.Oc
53.Ar time
54.Op Ar warning-message ...
55.Sh DESCRIPTION
56The
57.Nm
58utility provides an automated shutdown procedure for super-users
59to nicely notify users when the system is shutting down,
60saving them from system administrators, hackers, and gurus, who
61would otherwise not bother with such niceties.
62.Pp
63The following options are available:
64.Bl -tag -width indent
65.It Fl h
66The system is halted at the specified
67.Ar time .
68.It Fl p
69The system is halted and the power is turned off
70(hardware support required)
71at the specified
72.Ar time .
73.It Fl r
74The system is rebooted at the specified
75.Ar time .
76.It Fl k
77Kick everybody off.
78The
79.Fl k
80option
81does not actually halt the system, but leaves the
82system multi-user with logins disabled (for all but super-user).
83.It Fl o
84If one of the
85.Fl h ,
86.Fl p
87or
88.Fl r
89is specified,
90.Nm
91will execute
92.Xr halt 8
93or
94.Xr reboot 8
95instead of sending signal to
96.Xr init 8 .
97.It Fl n
98If the
99.Fl o
100is specified, prevent the file system cache from being flushed by passing
101.Fl n
102option to
103.Xr halt 8
104or
105.Xr reboot 8 .
106This option should probably not be used.
107.It Ar time
108.Ar Time
109is the time at which
110.Nm
111will bring the system down and
112may be the word
113.Ar now
114(indicating an immediate shutdown) or
115specify a future time in one of two formats:
116.Ar +number ,
117or
118.Ar yymmddhhmm ,
119where the year, month, and day may be defaulted
120to the current system values.  The first form brings the system down in
121.Ar number
122minutes and the second at the absolute time specified.
123.It Ar warning-message
124Any other arguments comprise the warning message that is broadcast
125to users currently logged into the system.
126.It Fl
127If
128.Sq Fl
129is supplied as an option, the warning message is read from the standard
130input.
131.El
132.Pp
133At intervals, becoming more frequent as apocalypse approaches
134and starting at ten hours before shutdown, warning messages are displayed
135on the terminals of all users logged in.  Five minutes before
136shutdown, or immediately if shutdown is in less than 5 minutes,
137logins are disabled by creating
138.Pa /var/run/nologin
139and copying the
140warning message there.  If this file exists when a user attempts to
141log in,
142.Xr login 1
143prints its contents and exits.  The file is
144removed just before
145.Nm
146exits.
147.Pp
148At shutdown time a message is written to the system log, containing the
149time of shutdown, the person who initiated the shutdown and the reason.
150Corresponding signal is then sent to
151.Xr init 8
152to respectively halt, reboot or bring the system down to single-user state
153(depending on the above options).
154The time of the shutdown and the warning message
155are placed in
156.Pa /var/run/nologin
157and should be used to
158inform the users about when the system will be back up
159and why it is going down (or anything else).
160.Pp
161A scheduled shutdown can be canceled by killing the
162.Nm
163process (a
164.Dv SIGTERM
165should suffice).
166The
167.Pa /var/run/nologin
168file that
169.Nm
170created will be removed automatically.
171.Sh FILES
172.Bl -tag -width /var/run/nologin -compact
173.It Pa /var/run/nologin
174tells login not to let anyone log in
175.El
176.Sh SEE ALSO
177.Xr kill 1 ,
178.Xr login 1 ,
179.Xr wall 1 ,
180.Xr nologin 5 ,
181.Xr halt 8 ,
182.Xr init 8 ,
183.Xr reboot 8
184.Sh BACKWARD COMPATIBILITY
185The hours and minutes in the second time format may be separated by
186a colon (``:'') for backward compatibility.
187.Sh HISTORY
188The
189.Nm
190utility appeared in
191.Bx 4.0 .
192