1.\" $NetBSD: shutdown.8,v 1.38 2023/02/15 13:05:21 uwe 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 February 14, 2023 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 Ddfhknprvxz 41.Op Fl b Ar bootstr 42.Ar time 43.Op Ar message ... No | Fl 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 Fl 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 69to request a kernel core dump. 70If neither the 71.Fl h 72nor 73.Fl r 74flags are specified, then 75.Fl d 76also implies 77.Fl r . 78.It Fl f 79.Nm 80arranges, in the manner of 81.Xr fastboot 8 , 82for the file systems 83.Em not to be checked 84on reboot. 85.It Fl h 86The system is halted at the specified 87.Ar time , 88using 89.Xr halt 8 . 90.It Fl k 91Kick everybody off. 92The 93.Fl k 94option 95does not actually halt the system, but leaves the 96system multi-user with logins disabled (for all but super-user). 97.It Fl n 98Prevent the normal 99.Xr sync 2 100before stopping. 101.It Fl p 102The system is powered down at the specified 103.Ar time , 104using 105.Xr poweroff 8 . 106If the powerdown fails, or the system does not support software powerdown, 107the system will simply halt instead. 108.It Fl r 109The system is rebooted at the specified 110.Ar time , 111using 112.Xr reboot 8 . 113.It Fl v 114To enable verbose messages on the console, pass 115.Fl v 116to 117.Xr reboot 8 118or 119.Xr halt 8 . 120.It Fl x 121To enable debugging messages on the console, pass 122.Fl x 123to 124.Xr reboot 8 125or 126.Xr halt 8 . 127.It Fl z 128To silence some shutdown messages on the console, pass 129.Fl z 130to 131.Xr reboot 8 132or 133.Xr halt 8 . 134.It Fl D 135Prevents 136.Nm 137from detaching from the tty with 138.Xr fork 2 No / Xr exit 3 . 139.It Ar time 140The time at which 141.Nm 142will bring the system down and 143may be the word 144.Cm now 145or a future time in one of two formats: 146.Cm + Ns Ar number , 147or 148.Sm off 149.Oo Oo Oo Oo Oo Ar cc Oc Ar yy Oc Ar mm Oc Ar dd Oc Ar hh Oc Ar mm , 150.Sm on 151where the century, year, month, day, and hour are two digit decimal 152values, which may be defaulted 153to the current system values. 154The two digit (decimal, even with a leading zero) minute field is 155required in this form. 156The first form brings the system down 157.Ar number 158minutes from the current time; the second brings the system down at the 159absolute time specified. 160If the century is not specified, but the year is, 161the century defaults to 2000 162.Po 163.Ar cc No = 20 , 164the 21st century 165.Pc 166for years between 20 and 99, 167or 2100 for years between 0 and 19. 168A leading zero in the 169.Ar yy 170value (as with all the others) is 171.Em not 172optional. 173.It Ar message ... 174Any other arguments comprise the warning message that is broadcast 175to users currently logged into the system. 176.It Fl 177If 178.Fl 179is supplied as the only argument after the time, the warning message is read 180from the standard input. 181.El 182.Sh BEHAVIOR 183At intervals, becoming more frequent as apocalypse approaches 184and starting at ten hours before shutdown, warning messages are displayed 185on the terminals of all users logged in. 186Five minutes before shutdown, or immediately if shutdown is in less 187than 5 minutes, logins are disabled by creating 188.Pa /etc/nologin 189and copying the warning message there. 190If this file exists when a user attempts to log in, 191.Xr login 1 192prints its contents and exits. 193The file is removed just before 194.Nm 195exits. 196.Pp 197At shutdown time, a message is written in the system log containing the 198time of shutdown, who initiated the shutdown, and the reason. 199Next a message is printed announcing the start of the system shutdown hooks. 200Then the shutdown hooks in 201.Pa /etc/rc.shutdown 202are run, and a message is printed indicating that they have completed. 203After a short delay, 204.Nm 205runs 206.Xr halt 8 207or 208.Xr reboot 8 , 209or sends a terminate 210signal to 211.Xr init 8 212to bring the system down to single-user mode, depending on the choice 213of options. 214.Pp 215The time of the shutdown and the warning message are placed in 216.Pa /etc/nologin 217and should be used to tell the users why the system is 218going down, when it will be back up, and to share any other pertinent 219information. 220.Sh FILES 221.Bl -tag -width Pa -compact 222.It Pa /etc/nologin 223Tells 224.Xr login 1 225not to let anyone log in 226.It Pa /fastboot 227Tells 228.Xr rc 8 229not to run 230.Xr fsck 8 231when rebooting 232.It Pa /etc/rc.shutdown 233System shutdown commands 234.El 235.Sh SEE ALSO 236.Xr login 1 , 237.Xr wall 1 , 238.Xr fastboot 8 , 239.Xr halt 8 , 240.Xr init 8 , 241.Xr poweroff 8 , 242.Xr reboot 8 , 243.Xr rescue 8 244.Sh BACKWARD COMPATIBILITY 245The hours and minutes in the second time format may be separated by 246a colon 247.Pq Ql \&: 248for backward compatibility. 249.Sh HISTORY 250A 251.Nm 252command was originally written by Ian Johnstone for UNSW's modified 253.At v6 , 254modified, and then incorporated in 255.Bx 4.1 . 256