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