xref: /freebsd/sbin/shutdown/shutdown.8 (revision 6c7ec630c24fded12e237b5ffda115cc268b75c2)
18fae3551SRodney W. Grimes.\" Copyright (c) 1988, 1991, 1993
28fae3551SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
38fae3551SRodney W. Grimes.\"
48fae3551SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
58fae3551SRodney W. Grimes.\" modification, are permitted provided that the following conditions
68fae3551SRodney W. Grimes.\" are met:
78fae3551SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
88fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
98fae3551SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
108fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
118fae3551SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
138fae3551SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
148fae3551SRodney W. Grimes.\"    without specific prior written permission.
158fae3551SRodney W. Grimes.\"
168fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
178fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
188fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
198fae3551SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
208fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
218fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
228fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
238fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
248fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
258fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
268fae3551SRodney W. Grimes.\" SUCH DAMAGE.
278fae3551SRodney W. Grimes.\"
28*6c7ec630SKyle Evans.Dd August 4, 2024
298fae3551SRodney W. Grimes.Dt SHUTDOWN 8
309fe48c6eSRuslan Ermilov.Os
318fae3551SRodney W. Grimes.Sh NAME
326868734cSPawel Jakub Dawidek.Nm shutdown ,
336868734cSPawel Jakub Dawidek.Nm poweroff
348fae3551SRodney W. Grimes.Nd "close down the system at a given time"
358fae3551SRodney W. Grimes.Sh SYNOPSIS
367c7fb079SRuslan Ermilov.Nm
378fae3551SRodney W. Grimes.Op Fl
3835cd460fSRuslan Ermilov.Oo
39e60baa72SWarner Losh.Fl c | Fl h | Fl p |
4035cd460fSRuslan Ermilov.Fl r | Fl k
4135cd460fSRuslan Ermilov.Oc
4235cd460fSRuslan Ermilov.Oo
4335cd460fSRuslan Ermilov.Fl o
4435cd460fSRuslan Ermilov.Op Fl n
4535cd460fSRuslan Ermilov.Oc
46*6c7ec630SKyle Evans.Op Fl q
478fae3551SRodney W. Grimes.Ar time
488fae3551SRodney W. Grimes.Op Ar warning-message ...
496868734cSPawel Jakub Dawidek.Nm poweroff
508fae3551SRodney W. Grimes.Sh DESCRIPTION
51629e80efSPhilippe CharnierThe
52629e80efSPhilippe Charnier.Nm
53629e80efSPhilippe Charnierutility provides an automated shutdown procedure for super-users
548fae3551SRodney W. Grimesto nicely notify users when the system is shutting down,
558fae3551SRodney W. Grimessaving them from system administrators, hackers, and gurus, who
568fae3551SRodney W. Grimeswould otherwise not bother with such niceties.
57e0dfa1c4SGordon BerglingIn order to use the
58e0dfa1c4SGordon Bergling.Nm
59e0dfa1c4SGordon Berglingcommand, the user must have root privileges or be a member of the
60e0dfa1c4SGordon Berglingoperator group.
618fae3551SRodney W. Grimes.Pp
62d3714863SPhilippe CharnierThe following options are available:
63d3714863SPhilippe Charnier.Bl -tag -width indent
64e60baa72SWarner Losh.It Fl c
65e60baa72SWarner LoshThe system is power cycled (power turned off and then back on)
66e60baa72SWarner Loshat the specified time.
67e60baa72SWarner LoshIf the hardware doesn't support power cycle, the system will be
6873c6e0c3SWarner Loshrebooted.
69e60baa72SWarner LoshAt the present time, only systems with BMC supported by the
70e60baa72SWarner Losh.Xr ipmi 4
71e60baa72SWarner Loshdriver that implement this functionality support this flag.
72e60baa72SWarner LoshThe amount of time the system is off is dependent on the device
73e60baa72SWarner Loshthat implements this feature.
748fae3551SRodney W. Grimes.It Fl h
758fae3551SRodney W. GrimesThe system is halted at the specified
7635cd460fSRuslan Ermilov.Ar time .
7735cd460fSRuslan Ermilov.It Fl p
7835cd460fSRuslan ErmilovThe system is halted and the power is turned off
79e60baa72SWarner Losh(hardware support required, otherwise the system is halted)
8035cd460fSRuslan Ermilovat the specified
8135cd460fSRuslan Ermilov.Ar time .
8235cd460fSRuslan Ermilov.It Fl r
8335cd460fSRuslan ErmilovThe system is rebooted at the specified
8435cd460fSRuslan Ermilov.Ar time .
858fae3551SRodney W. Grimes.It Fl k
868fae3551SRodney W. GrimesKick everybody off.
878fae3551SRodney W. GrimesThe
888fae3551SRodney W. Grimes.Fl k
898fae3551SRodney W. Grimesoption
908fae3551SRodney W. Grimesdoes not actually halt the system, but leaves the
918fae3551SRodney W. Grimessystem multi-user with logins disabled (for all but super-user).
9235cd460fSRuslan Ermilov.It Fl o
9335cd460fSRuslan ErmilovIf one of the
94e60baa72SWarner Losh.Fl c ,
9535cd460fSRuslan Ermilov.Fl h ,
9635cd460fSRuslan Ermilov.Fl p
9735cd460fSRuslan Ermilovor
9835cd460fSRuslan Ermilov.Fl r
9954d3d7c0SGlen Barberoptions are specified,
10035cd460fSRuslan Ermilov.Nm
10135cd460fSRuslan Ermilovwill execute
10235cd460fSRuslan Ermilov.Xr halt 8
10335cd460fSRuslan Ermilovor
1048fae3551SRodney W. Grimes.Xr reboot 8
10554d3d7c0SGlen Barberinstead of sending a signal to
10635cd460fSRuslan Ermilov.Xr init 8 .
10735cd460fSRuslan Ermilov.It Fl n
10835cd460fSRuslan ErmilovIf the
10935cd460fSRuslan Ermilov.Fl o
11054d3d7c0SGlen Barberoption is specified, prevent the file system cache from being flushed by passing
11135cd460fSRuslan Ermilov.Fl n
11254d3d7c0SGlen Barberto
11335cd460fSRuslan Ermilov.Xr halt 8
11435cd460fSRuslan Ermilovor
11535cd460fSRuslan Ermilov.Xr reboot 8 .
11635cd460fSRuslan ErmilovThis option should probably not be used.
117*6c7ec630SKyle Evans.It Fl q
118*6c7ec630SKyle EvansShut down quietly.
119*6c7ec630SKyle EvansSuppress the warning message to all logged in users about system shutdown.
120*6c7ec630SKyle EvansIt is an error to supply a
121*6c7ec630SKyle Evans.Ar warning-message
122*6c7ec630SKyle Evanswhen warnings are suppressed.
1238fae3551SRodney W. Grimes.It Ar time
1248fae3551SRodney W. Grimes.Ar Time
1258fae3551SRodney W. Grimesis the time at which
126d3714863SPhilippe Charnier.Nm
1278fae3551SRodney W. Grimeswill bring the system down and
12854d3d7c0SGlen Barbermay be the case-insensitive word
1298fae3551SRodney W. Grimes.Ar now
1308fae3551SRodney W. Grimes(indicating an immediate shutdown) or
13154d3d7c0SGlen Barbera future time in one of two formats:
1328fae3551SRodney W. Grimes.Ar +number ,
1338fae3551SRodney W. Grimesor
1348fae3551SRodney W. Grimes.Ar yymmddhhmm ,
1358fae3551SRodney W. Grimeswhere the year, month, and day may be defaulted
1369806e231SRuslan Ermilovto the current system values.
1379806e231SRuslan ErmilovThe first form brings the system down in
1388fae3551SRodney W. Grimes.Ar number
1398fae3551SRodney W. Grimesminutes and the second at the absolute time specified.
140c7d73a4dSGleb Kurtsou.Ar +number
141c7d73a4dSGleb Kurtsoumay be specified in units other than minutes by appending the corresponding
142c7d73a4dSGleb Kurtsousuffix:
143c7d73a4dSGleb Kurtsou.Dq Li s ,
144c7d73a4dSGleb Kurtsou.Dq Li sec ,
145c7d73a4dSGleb Kurtsou.Dq Li m ,
146814321a0SNiclas Zeising.Dq Li min ,
147c7d73a4dSGleb Kurtsou.Dq Li h ,
148c7d73a4dSGleb Kurtsou.Dq Li hour .
149cb1101afSEitan Adler.Pp
150cb1101afSEitan AdlerIf an absolute time is specified, but not a date,
151cb1101afSEitan Adlerand that time today has already passed,
152cb1101afSEitan Adler.Nm
153cb1101afSEitan Adlerwill assume that the same time tomorrow was meant.
154cb1101afSEitan Adler(If a complete date is specified which has already passed,
155cb1101afSEitan Adler.Nm
156cb1101afSEitan Adlerwill print an error and exit without shutting the system down.)
1578fae3551SRodney W. Grimes.It Ar warning-message
1588fae3551SRodney W. GrimesAny other arguments comprise the warning message that is broadcast
1598fae3551SRodney W. Grimesto users currently logged into the system.
1608fae3551SRodney W. Grimes.It Fl
1618fae3551SRodney W. GrimesIf
162463cfa80SRuslan Ermilov.Sq Fl
1638fae3551SRodney W. Grimesis supplied as an option, the warning message is read from the standard
1648fae3551SRodney W. Grimesinput.
1658fae3551SRodney W. Grimes.El
1668fae3551SRodney W. Grimes.Pp
1678fae3551SRodney W. GrimesAt intervals, becoming more frequent as apocalypse approaches
1688fae3551SRodney W. Grimesand starting at ten hours before shutdown, warning messages are displayed
1699806e231SRuslan Ermilovon the terminals of all users logged in.
1709806e231SRuslan ErmilovFive minutes before
1718fae3551SRodney W. Grimesshutdown, or immediately if shutdown is in less than 5 minutes,
1728fae3551SRodney W. Grimeslogins are disabled by creating
17316ceea1bSSatoshi Asami.Pa /var/run/nologin
1748fae3551SRodney W. Grimesand copying the
1759806e231SRuslan Ermilovwarning message there.
1769806e231SRuslan ErmilovIf this file exists when a user attempts to
1778fae3551SRodney W. Grimeslog in,
1788fae3551SRodney W. Grimes.Xr login 1
1799806e231SRuslan Ermilovprints its contents and exits.
1809806e231SRuslan ErmilovThe file is
1818fae3551SRodney W. Grimesremoved just before
182d3714863SPhilippe Charnier.Nm
1838fae3551SRodney W. Grimesexits.
1848fae3551SRodney W. Grimes.Pp
18535cd460fSRuslan ErmilovAt shutdown time a message is written to the system log, containing the
18635cd460fSRuslan Ermilovtime of shutdown, the person who initiated the shutdown and the reason.
18754d3d7c0SGlen BarberThe corresponding signal is then sent to
188d3714863SPhilippe Charnier.Xr init 8
18935cd460fSRuslan Ermilovto respectively halt, reboot or bring the system down to single-user state
19035cd460fSRuslan Ermilov(depending on the above options).
1918fae3551SRodney W. GrimesThe time of the shutdown and the warning message
1928fae3551SRodney W. Grimesare placed in
19316ceea1bSSatoshi Asami.Pa /var/run/nologin
1948fae3551SRodney W. Grimesand should be used to
1958fae3551SRodney W. Grimesinform the users about when the system will be back up
1968fae3551SRodney W. Grimesand why it is going down (or anything else).
1971f240b4cSDima Dorfman.Pp
1981f240b4cSDima DorfmanA scheduled shutdown can be canceled by killing the
1991f240b4cSDima Dorfman.Nm
2001f240b4cSDima Dorfmanprocess (a
2011f240b4cSDima Dorfman.Dv SIGTERM
2021f240b4cSDima Dorfmanshould suffice).
2031f240b4cSDima DorfmanThe
2041f240b4cSDima Dorfman.Pa /var/run/nologin
2051f240b4cSDima Dorfmanfile that
2061f240b4cSDima Dorfman.Nm
2071f240b4cSDima Dorfmancreated will be removed automatically.
2081aa26f52STom Rhodes.Pp
2091aa26f52STom RhodesWhen run without options, the
2101aa26f52STom Rhodes.Nm
2111aa26f52STom Rhodesutility will place the system into single user mode at the
2121aa26f52STom Rhodes.Ar time
2131aa26f52STom Rhodesspecified.
2146868734cSPawel Jakub Dawidek.Pp
21554d3d7c0SGlen BarberCalling
21654d3d7c0SGlen Barber.Dq Nm poweroff
21754d3d7c0SGlen Barberis equivalent to running:
2186868734cSPawel Jakub Dawidek.Bd -literal -offset indent
2196868734cSPawel Jakub Dawidekshutdown -p now
2206868734cSPawel Jakub Dawidek.Ed
2218fae3551SRodney W. Grimes.Sh FILES
22216ceea1bSSatoshi Asami.Bl -tag -width /var/run/nologin -compact
22316ceea1bSSatoshi Asami.It Pa /var/run/nologin
22454d3d7c0SGlen Barbertells
22554d3d7c0SGlen Barber.Xr login 1
22654d3d7c0SGlen Barbernot to let anyone log in
2278fae3551SRodney W. Grimes.El
2287cf62795SJoel Dahl.Sh EXAMPLES
2297cf62795SJoel DahlReboot the system in 30 minutes and display a warning message on the terminals
2307cf62795SJoel Dahlof all users currently logged in:
2317cf62795SJoel Dahl.Pp
2327cf62795SJoel Dahl.Dl # shutdown -r +30 \&"System will reboot\&"
2338ee0cef5SRuslan Ermilov.Sh COMPATIBILITY
2348ee0cef5SRuslan ErmilovThe hours and minutes in the second time format may be separated by
2358ee0cef5SRuslan Ermilova colon (``:'') for backward compatibility.
2368fae3551SRodney W. Grimes.Sh SEE ALSO
2371f240b4cSDima Dorfman.Xr kill 1 ,
2388fae3551SRodney W. Grimes.Xr login 1 ,
2398fae3551SRodney W. Grimes.Xr wall 1 ,
2408c1d6cc7SMasafumi Max NAKANE.Xr nologin 5 ,
2418fae3551SRodney W. Grimes.Xr halt 8 ,
24235cd460fSRuslan Ermilov.Xr init 8 ,
2438fae3551SRodney W. Grimes.Xr reboot 8
2448fae3551SRodney W. Grimes.Sh HISTORY
2456c968f71SSevan JaniyanA
2468fae3551SRodney W. Grimes.Nm
2476c968f71SSevan Janiyancommand was originally written by Ian Johnstone for UNSW's modified
2486c968f71SSevan Janiyan.At "6th Edn" .
2496c968f71SSevan JaniyanIt was modified and then incorporated in
2506c968f71SSevan Janiyan.Bx 4.1 .
251