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