1.\" $NetBSD: shutdown.8,v 1.26 2003/08/07 10:04:39 agc 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. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95 31.\" 32.Dd October 18, 2002 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 b Ar bootstr 41.Op Fl Ddfhknpr 42.Ar time 43.Op Ar message ... | Ar - 44.Sh DESCRIPTION 45.Nm 46provides an automated shutdown procedure for super-users 47to nicely notify users when the system is shutting down, 48saving them from system administrators, hackers, and gurus, who 49would otherwise not bother with such niceties. 50.Pp 51Available friendlinesses: 52.Bl -tag -width bootstr 53.It Fl b Ar bootstr 54The given 55.Ar bootstr 56is passed to 57.Xr reboot 8 58for the benefit of those systems that can pass boot arguments to the 59firmware. 60Currently, this only affects sun3 and sparc machines. 61.It Fl d 62.Nm 63will pass the 64.Fl d 65flag to 66.Xr reboot 8 67or 68.Xr halt 8 . 69If neither the 70.Fl h 71or 72.Fl r 73flags are specified, then 74.Fl d 75also implies 76.Fl r . 77.It Fl f 78.Nm 79arranges, in the manner of 80.Xr fastboot 8 , 81for the file systems 82.Em not to be 83checked on reboot. 84.It Fl h 85The system is halted at the specified 86.Ar time 87when 88.Nm 89execs 90.Xr halt 8 . 91.It Fl k 92Kick everybody off. 93The 94.Fl k 95option 96does not actually halt the system, but leaves the 97system multi-user with logins disabled (for all but super-user). 98.It Fl n 99Prevent the normal 100.Xr sync 2 101before stopping. 102.It Fl p 103The system is powered down at the specified 104.Ar time 105when 106.Nm 107execs 108.Xr halt 8 . 109If the powerdown fails, or the system does not support software powerdown, 110the system will simply halt. 111.It Fl r 112The system is rebooted at the specified 113.Ar time 114when 115.Nm 116execs 117.Xr reboot 8 . 118.It Fl D 119Prevents 120.Nm 121from detaching from the tty with 122.Xr fork 2 Ns / 123.Xr exit 3 . 124.It Ar time 125.Ar Time 126is the time at which 127.Nm 128will bring the system down and 129may be the word 130.Ar now 131or a future time in one of two formats: 132.Ar +number , 133or 134.Ar [[[[[cc]yy]mm]dd]hh]mm , 135where the century, year, month, day, and hour may be defaulted 136to the current system values. 137The first form brings the system down 138.Ar number 139minutes from the current time; the second brings the system down at the 140absolute time specified. 141If the century is not specified, it defaults to 1900 for years between 69 142and 99, or 2000 for years between 0 and 68. 143A leading zero in the 144.Dq yy 145value is 146.Em not 147optional. 148.It Ar message ... 149Any other arguments comprise the warning message that is broadcast 150to users currently logged into the system. 151.It Ar - 152If 153.Ar - 154is supplied as the only argument after the time, the warning message is read 155from the standard input. 156.El 157.Pp 158At intervals, becoming more frequent as apocalypse approaches 159and starting at ten hours before shutdown, warning messages are displayed 160on the terminals of all users logged in. 161Five minutes before shutdown, or immediately if shutdown is in less 162than 5 minutes, logins are disabled by creating 163.Pa /etc/nologin 164and copying the warning message there. 165If this file exists when a user attempts to log in, 166.Xr login 1 167prints its contents and exits. 168The file is removed just before 169.Nm 170exits. 171.Pp 172At shutdown time a message is written in the system log, containing the 173time of shutdown, who initiated the shutdown and the reason. 174Next a message is printed announcing the start of the system shutdown hooks. 175Then the shutdown hooks in 176.Pa /etc/rc.shutdown 177are run. 178And a message is printed indicating that they have completed. 179After a short delay a terminate 180signal is then sent to 181.Xr init 8 182to bring the system down to single-user state (depending on above options). 183The time of the shutdown and the warning message are placed in 184.Pa /etc/nologin 185and should be used to inform the users about when the system will 186be back up and why it is going down (or anything else). 187.Sh FILES 188.Bl -tag -width /etc/rc.shutdown -compact 189.It Pa /etc/nologin 190tells 191.Xr login 1 192not to let anyone log in 193.It Pa /fastboot 194tells 195.Xr rc 8 196not to run fsck when rebooting 197.It Pa /etc/rc.shutdown 198System shutdown commands 199.El 200.Sh SEE ALSO 201.Xr login 1 , 202.Xr wall 1 , 203.Xr fastboot 8 , 204.Xr halt 8 , 205.Xr reboot 8 206.Sh BACKWARD COMPATIBILITY 207The hours and minutes in the second time format may be separated by 208a colon (``:'') for backward compatibility. 209.Sh HISTORY 210The 211.Nm 212command appeared in 213.Bx 4.0 . 214