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 January 11, 2020 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 c | 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 c 63The system is power cycled (power turned off and then back on) 64at the specified time. 65If the hardware doesn't support power cycle, the system will be 66rebooted. 67At the present time, only systems with BMC supported by the 68.Xr ipmi 4 69driver that implement this functionality support this flag. 70The amount of time the system is off is dependent on the device 71that implements this feature. 72.It Fl h 73The system is halted at the specified 74.Ar time . 75.It Fl p 76The system is halted and the power is turned off 77(hardware support required, otherwise the system is halted) 78at the specified 79.Ar time . 80.It Fl r 81The system is rebooted at the specified 82.Ar time . 83.It Fl k 84Kick everybody off. 85The 86.Fl k 87option 88does not actually halt the system, but leaves the 89system multi-user with logins disabled (for all but super-user). 90.It Fl o 91If one of the 92.Fl c , 93.Fl h , 94.Fl p 95or 96.Fl r 97options are specified, 98.Nm 99will execute 100.Xr halt 8 101or 102.Xr reboot 8 103instead of sending a signal to 104.Xr init 8 . 105.It Fl n 106If the 107.Fl o 108option is specified, prevent the file system cache from being flushed by passing 109.Fl n 110to 111.Xr halt 8 112or 113.Xr reboot 8 . 114This option should probably not be used. 115.It Ar time 116.Ar Time 117is the time at which 118.Nm 119will bring the system down and 120may be the case-insensitive word 121.Ar now 122(indicating an immediate shutdown) or 123a future time in one of two formats: 124.Ar +number , 125or 126.Ar yymmddhhmm , 127where the year, month, and day may be defaulted 128to the current system values. 129The first form brings the system down in 130.Ar number 131minutes and the second at the absolute time specified. 132.Ar +number 133may be specified in units other than minutes by appending the corresponding 134suffix: 135.Dq Li s , 136.Dq Li sec , 137.Dq Li m , 138.Dq Li min . 139.Dq Li h , 140.Dq Li hour . 141.Pp 142If an absolute time is specified, but not a date, 143and that time today has already passed, 144.Nm 145will assume that the same time tomorrow was meant. 146(If a complete date is specified which has already passed, 147.Nm 148will print an error and exit without shutting the system down.) 149.It Ar warning-message 150Any other arguments comprise the warning message that is broadcast 151to users currently logged into the system. 152.It Fl 153If 154.Sq Fl 155is supplied as an option, the warning message is read from the standard 156input. 157.El 158.Pp 159At intervals, becoming more frequent as apocalypse approaches 160and starting at ten hours before shutdown, warning messages are displayed 161on the terminals of all users logged in. 162Five minutes before 163shutdown, or immediately if shutdown is in less than 5 minutes, 164logins are disabled by creating 165.Pa /var/run/nologin 166and copying the 167warning message there. 168If this file exists when a user attempts to 169log in, 170.Xr login 1 171prints its contents and exits. 172The file is 173removed just before 174.Nm 175exits. 176.Pp 177At shutdown time a message is written to the system log, containing the 178time of shutdown, the person who initiated the shutdown and the reason. 179The corresponding signal is then sent to 180.Xr init 8 181to respectively halt, reboot or bring the system down to single-user state 182(depending on the above options). 183The time of the shutdown and the warning message 184are placed in 185.Pa /var/run/nologin 186and should be used to 187inform the users about when the system will be back up 188and why it is going down (or anything else). 189.Pp 190A scheduled shutdown can be canceled by killing the 191.Nm 192process (a 193.Dv SIGTERM 194should suffice). 195The 196.Pa /var/run/nologin 197file that 198.Nm 199created will be removed automatically. 200.Pp 201When run without options, the 202.Nm 203utility will place the system into single user mode at the 204.Ar time 205specified. 206.Pp 207Calling 208.Dq Nm poweroff 209is equivalent to running: 210.Bd -literal -offset indent 211shutdown -p now 212.Ed 213.Sh FILES 214.Bl -tag -width /var/run/nologin -compact 215.It Pa /var/run/nologin 216tells 217.Xr login 1 218not to let anyone log in 219.El 220.Sh EXAMPLES 221Reboot the system in 30 minutes and display a warning message on the terminals 222of all users currently logged in: 223.Pp 224.Dl # shutdown -r +30 \&"System will reboot\&" 225.Sh COMPATIBILITY 226The hours and minutes in the second time format may be separated by 227a colon (``:'') for backward compatibility. 228.Sh SEE ALSO 229.Xr kill 1 , 230.Xr login 1 , 231.Xr wall 1 , 232.Xr nologin 5 , 233.Xr halt 8 , 234.Xr init 8 , 235.Xr reboot 8 236.Sh HISTORY 237A 238.Nm 239command was originally written by Ian Johnstone for UNSW's modified 240.At "6th Edn" . 241It was modified and then incorporated in 242.Bx 4.1 . 243