2009-09-10 13:58:49 +05:30
|
|
|
'\" -*- coding: UTF-8 -*-
|
|
|
|
.\" Copyright (C) 1998-2003 Miquel van Smoorenburg.
|
|
|
|
.\"
|
|
|
|
.\" This program is free software; you can redistribute it and/or modify
|
|
|
|
.\" it under the terms of the GNU General Public License as published by
|
|
|
|
.\" the Free Software Foundation; either version 2 of the License, or
|
|
|
|
.\" (at your option) any later version.
|
|
|
|
.\"
|
|
|
|
.\" This program is distributed in the hope that it will be useful,
|
|
|
|
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
.\" GNU General Public License for more details.
|
|
|
|
.\"
|
|
|
|
.\" You should have received a copy of the GNU General Public License
|
|
|
|
.\" along with this program; if not, write to the Free Software
|
|
|
|
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
.\"
|
|
|
|
.\"{{{}}}
|
|
|
|
.\"{{{ Title
|
2022-02-16 02:31:41 +05:30
|
|
|
.TH SHUTDOWN 8 "November 12, 2003" "sysvinit " "Linux System Administrator's Manual"
|
2009-09-10 13:58:49 +05:30
|
|
|
.\"}}}
|
|
|
|
.\"{{{ Name
|
|
|
|
.SH NAME
|
|
|
|
shutdown \- bring the system down
|
|
|
|
.\"}}}
|
|
|
|
.\"{{{ Synopsis
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B /sbin/shutdown
|
2021-12-22 23:02:50 +05:30
|
|
|
.RB [ \-akrhPHfFncqQ ]
|
2009-09-10 13:58:49 +05:30
|
|
|
.RB [ \-t
|
|
|
|
.IR sec ]
|
|
|
|
.I time
|
2009-11-21 04:03:35 +05:30
|
|
|
.RI [ "warning message" ]
|
2009-09-10 13:58:49 +05:30
|
|
|
.\"}}}
|
|
|
|
.\"{{{ Description
|
|
|
|
.SH DESCRIPTION
|
|
|
|
\fBshutdown\fP brings the system down in a secure way. All logged-in users are
|
2021-12-28 01:44:42 +05:30
|
|
|
notified that the system is going down, and \fBlogin\fP(1) is blocked.
|
2009-09-10 13:58:49 +05:30
|
|
|
It is possible to shut the system down immediately or after a specified delay.
|
|
|
|
All processes are first notified that the system is going down by the
|
2021-12-28 01:44:42 +05:30
|
|
|
signal \fBSIGTERM\fP. This gives programs like \fBvi\fP(1)
|
2009-09-10 13:58:49 +05:30
|
|
|
the time to save the file being edited,
|
|
|
|
mail and news processing programs a chance to exit cleanly, etc.
|
|
|
|
\fBshutdown\fP does its job by signalling the \fBinit\fP process,
|
|
|
|
asking it to change the runlevel.
|
|
|
|
Runlevel \fB0\fP is used to halt the system, runlevel \fB6\fP is used
|
|
|
|
to reboot the system, and runlevel \fB1\fP is used to put to system into
|
|
|
|
a state where administrative tasks can be performed; this is the default
|
2021-12-28 01:44:42 +05:30
|
|
|
if neither the \fB-h\fP or \fB-r\fP flag is given to \fBshutdown\fP.
|
2009-09-10 13:58:49 +05:30
|
|
|
To see which actions are taken on halt or reboot see the appropriate
|
|
|
|
entries for these runlevels in the file \fI/etc/inittab\fP.
|
|
|
|
.\"}}}
|
|
|
|
.\"{{{ Options
|
|
|
|
.SH OPTIONS
|
|
|
|
.\"{{{ -a
|
|
|
|
.IP "\fB\-a\fP
|
2021-12-28 01:44:42 +05:30
|
|
|
Use \fI/etc/shutdown.allow\fP.
|
2009-09-10 13:58:49 +05:30
|
|
|
.\"}}}
|
|
|
|
.\"{{{ -k
|
|
|
|
.IP \fB\-k\fP
|
|
|
|
Don't really shutdown; only send the warning messages to everybody.
|
|
|
|
.\"}}}
|
|
|
|
.\"{{{ -r
|
|
|
|
.IP \fB\-r\fP
|
|
|
|
Reboot after shutdown.
|
|
|
|
.\"}}}
|
|
|
|
.\"{{{ -h
|
|
|
|
.IP \fB\-h\fP
|
2021-12-28 01:44:42 +05:30
|
|
|
Halt or power off after shutdown. Usually used with the \fB-P\fP or \fB-H\fP flags,
|
2019-04-08 21:32:41 +05:30
|
|
|
depending on whether we want to poweroff or simply stop the operating system.
|
2009-09-10 13:58:49 +05:30
|
|
|
.\"}}}
|
|
|
|
.\"{{{ -P
|
|
|
|
.IP \fB\-P\fP
|
2021-12-28 01:44:42 +05:30
|
|
|
Modifier to the \fB-h\fP flag. Halt action is to turn off the power.
|
|
|
|
Must be used with the \fB-h\fP flag.
|
2009-09-10 13:58:49 +05:30
|
|
|
.\"}}}
|
2009-11-21 04:03:35 +05:30
|
|
|
.\"{{{ -H
|
|
|
|
.IP \fB\-H\fP
|
2021-12-28 01:44:42 +05:30
|
|
|
Modifier to the \fB-h\fP flag. Halt action is to halt or drop into boot
|
|
|
|
monitor on systems that support it. Must be used with the \fB-h\fP flag.
|
2019-04-08 21:32:41 +05:30
|
|
|
Halting is often used to run through the shutdown process and leave
|
|
|
|
output on the screen for debugging purposes. Or when the user wants the OS to
|
|
|
|
stop, but leave the power on. To power off at the end of the shutdown sequence
|
2021-12-28 01:44:42 +05:30
|
|
|
use the \fB-P\fP modifier instead.
|
2009-09-10 13:58:49 +05:30
|
|
|
.\"}}}
|
|
|
|
.\"{{{ -f
|
|
|
|
.IP \fB\-f\fP
|
2021-12-28 01:44:42 +05:30
|
|
|
Skip \fBfsck\fP(8) on reboot.
|
2009-09-10 13:58:49 +05:30
|
|
|
.\"}}}
|
|
|
|
.\"{{{ -F
|
|
|
|
.IP \fB\-F\fP
|
2021-12-28 01:44:42 +05:30
|
|
|
Force \fBfsck\fP(8) on reboot.
|
2009-09-10 13:58:49 +05:30
|
|
|
.\"}}}
|
2009-11-21 04:03:35 +05:30
|
|
|
.\"{{{ -n
|
|
|
|
.IP \fB\-n\fP
|
|
|
|
[DEPRECATED] Don't call \fBinit\fP(8) to do the shutdown but do it ourself.
|
|
|
|
The use of this option is discouraged, and its results are not always what
|
|
|
|
you'd expect.
|
|
|
|
.\"}}}
|
2009-09-10 13:58:49 +05:30
|
|
|
.\"{{{ -c
|
|
|
|
.IP \fB\-c\fP
|
2021-12-28 01:44:42 +05:30
|
|
|
Cancel a waiting shutdown. (\fBshutdown now\fP is no longer waiting.) With
|
2010-03-23 20:07:01 +05:30
|
|
|
this option it is of course not possible to give the time argument, but
|
|
|
|
you can enter explanatory message arguments on the command line that
|
|
|
|
will be sent to all users.
|
2018-11-02 01:51:47 +05:30
|
|
|
.\"{{{ -q
|
|
|
|
.IP \fB\-q
|
2021-12-28 01:44:42 +05:30
|
|
|
Reduce the number of warnings \fBshutdown\fP displays. Usually \fBshutdown\fP displays
|
2018-11-02 01:51:47 +05:30
|
|
|
warnings every 15 minutes and then every minute in the last 10 minutes of the
|
2021-12-28 01:44:42 +05:30
|
|
|
countdown until \fItime\fP is reached. When \fB-q\fP is specified
|
|
|
|
\fBshutdown\fP only warns at 60 minute intervals, at the 10 minute mark,
|
|
|
|
at the 5 minute mark, and when the shutdown process actually happens.
|
2018-11-02 01:51:47 +05:30
|
|
|
.\"{{{ -Q
|
|
|
|
.IP \fB\-Q
|
2021-12-28 01:44:42 +05:30
|
|
|
Silence warnings prior to shutting down. Usually \fBshutdown\fP displays
|
2018-11-02 01:51:47 +05:30
|
|
|
warnings every 15 minutes and then every minute in the last 10 minutes of the
|
2021-12-28 01:44:42 +05:30
|
|
|
countdown until \fItime\fP is reached. When \fB-Q\fP is specified
|
|
|
|
\fBshutdown\fP only warns when the shutdown process actually happens. All
|
2018-11-02 01:51:47 +05:30
|
|
|
other warning intervals are suppressed.
|
2009-09-10 13:58:49 +05:30
|
|
|
.\"}}}
|
2009-11-21 04:03:35 +05:30
|
|
|
.\"{{{ -t sec
|
|
|
|
.IP "\fB\-t\fP \fIsec\fP"
|
2018-10-23 06:14:39 +05:30
|
|
|
Tell \fBinit\fP(8) to wait \fIsec\fP seconds between sending all processes the
|
2021-12-28 01:44:42 +05:30
|
|
|
warning (\fBSIGTERM\fP) and the kill signal (\fBSIGKILL\fP), before changing to another runlevel.
|
2018-10-23 06:14:39 +05:30
|
|
|
The default time, if no value is specified, between these two signals is
|
2021-12-28 01:44:42 +05:30
|
|
|
three seconds. Warning: when \fBshutdown\fP calls \fBinit\fP(8) to perform the shutdown (the
|
|
|
|
default behavior), \fBinit\fP(8) checks to see if all processes have terminated
|
2018-10-23 06:14:39 +05:30
|
|
|
and will stop waiting early once its children have all terminated.
|
2021-12-28 01:44:42 +05:30
|
|
|
When \fBshutdown\fP is called with the \fB-n\fP flag, it waits the full time specified
|
2018-10-23 06:14:39 +05:30
|
|
|
(or three seconds) even if all other processes have terminated.
|
2009-11-21 04:03:35 +05:30
|
|
|
.\"}}}
|
2009-09-10 13:58:49 +05:30
|
|
|
.\"{{{ time
|
|
|
|
.IP \fItime\fP
|
|
|
|
When to shutdown.
|
|
|
|
.\"}}}
|
|
|
|
.\"{{{ warning-message
|
2009-11-21 04:03:35 +05:30
|
|
|
.IP "\fIwarning message\fP"
|
2009-09-10 13:58:49 +05:30
|
|
|
Message to send to all users.
|
|
|
|
.\"}}}
|
|
|
|
.PP
|
|
|
|
The \fItime\fP argument can have different formats. First, it can be an
|
|
|
|
absolute time in the format \fIhh:mm\fP, in which \fIhh\fP is the hour
|
|
|
|
(1 or 2 digits) and \fImm\fP is the minute of the hour (in two digits).
|
|
|
|
Second, it can be in the format \fB+\fP\fIm\fP, in which \fIm\fP is the
|
2020-06-20 22:11:18 +05:30
|
|
|
number of minutes to wait. Third, it can be in the format \fB+\fP\fIhh:mm\fP,
|
|
|
|
in which \fIhh:mm\fP is the number of hours and minutes to wait.
|
|
|
|
The word \fBnow\fP is an alias for \fB+0\fP.
|
2009-09-10 13:58:49 +05:30
|
|
|
.PP
|
2021-12-28 01:44:42 +05:30
|
|
|
If \fBshutdown\fP is called with a delay, it will create the advisory file
|
2009-09-10 13:58:49 +05:30
|
|
|
.I /etc/nologin
|
2021-12-28 01:44:42 +05:30
|
|
|
which causes programs such as \fBlogin\fP(1) to not allow new user
|
2009-09-10 13:58:49 +05:30
|
|
|
logins. This file is created five minutes before the shutdown sequence
|
2021-12-28 01:44:42 +05:30
|
|
|
starts. \fBshutdown\fP removes this file if it is stopped before it
|
2009-09-10 13:58:49 +05:30
|
|
|
can signal init (i.e. it is cancelled or something goes wrong).
|
2021-12-28 01:44:42 +05:30
|
|
|
It also removes it before calling \fBinit\fP(8) to change the runlevel.
|
2009-09-10 13:58:49 +05:30
|
|
|
.PP
|
|
|
|
The \fB\-f\fP flag means `reboot fast'. This only creates an advisory
|
|
|
|
file \fI/fastboot\fP which can be tested by the system when it comes
|
|
|
|
up again. The boot rc file can test if this file is present, and decide not
|
2021-12-28 01:44:42 +05:30
|
|
|
to run \fBfsck\fP(8) since the system has been shut down in the proper way.
|
2009-09-10 13:58:49 +05:30
|
|
|
After that, the boot process should remove \fI/fastboot\fP.
|
|
|
|
.PP
|
|
|
|
The \fB\-F\fP flag means `force fsck'. This only creates an advisory
|
|
|
|
file \fI/forcefsck\fP which can be tested by the system when it comes
|
|
|
|
up again. The boot rc file can test if this file is present, and decide
|
2021-12-28 01:44:42 +05:30
|
|
|
to run \fBfsck\fP(8) with a special `force' flag so that even properly
|
2009-09-10 13:58:49 +05:30
|
|
|
unmounted file systems get checked.
|
|
|
|
After that, the boot process should remove \fI/forcefsck\fP.
|
|
|
|
.PP
|
2021-12-28 01:44:42 +05:30
|
|
|
The \fB-n\fP flag causes \fBshutdown\fP not to call \fBinit\fP(8),
|
2009-09-10 13:58:49 +05:30
|
|
|
but to kill all running processes itself.
|
|
|
|
\fBshutdown\fP will then turn off quota, accounting, and swapping
|
|
|
|
and unmount all file systems.
|
|
|
|
.\"}}}
|
|
|
|
.\"{{{ Files
|
|
|
|
.SH ACCESS CONTROL
|
|
|
|
\fBshutdown\fP can be called from \fBinit\fP(8) when the magic keys
|
|
|
|
\fBCTRL-ALT-DEL\fP are pressed, by creating an appropriate entry in
|
|
|
|
\fI/etc/inittab\fP. This means that everyone who has physical access
|
|
|
|
to the console keyboard can shut the system down. To prevent this,
|
|
|
|
\fBshutdown\fP can check to see if an authorized user is logged in on
|
|
|
|
one of the virtual consoles. If \fBshutdown\fP is called with the \fB-a\fP
|
2021-12-28 01:44:42 +05:30
|
|
|
argument (add this to the invocation of shutdown in \fI/etc/inittab\fP),
|
2009-09-10 13:58:49 +05:30
|
|
|
it checks to see if the file \fI/etc/shutdown.allow\fP is present.
|
|
|
|
It then compares the login names in that file with the list of people
|
|
|
|
that are logged in on a virtual console (from \fI/var/run/utmp\fP). Only
|
|
|
|
if one of those authorized users \fBor root\fP is logged in, it will
|
|
|
|
proceed. Otherwise it will write the message
|
|
|
|
.sp 1
|
|
|
|
.nf
|
|
|
|
\fBshutdown: no authorized users logged in\fP
|
|
|
|
.fi
|
|
|
|
.sp 1
|
|
|
|
to the (physical) system console. The format of \fI/etc/shutdown.allow\fP
|
|
|
|
is one user name per line. Empty lines and comment lines (prefixed by a
|
|
|
|
\fB#\fP) are allowed. Currently there is a limit of 32 users in this file.
|
|
|
|
.sp 1
|
2021-12-28 01:44:42 +05:30
|
|
|
Note that if \fI/etc/shutdown.allow\fP is not present, the \fB-a\fP
|
2009-09-10 13:58:49 +05:30
|
|
|
argument is ignored.
|
|
|
|
.SH HALT OR POWEROFF
|
2021-12-28 01:44:42 +05:30
|
|
|
The \fB-H\fP option just sets the \fBinit\fP environment variable
|
|
|
|
\fBINIT_HALT\fP to \fBHALT\fP, and the \fB-P\fP option just sets
|
|
|
|
that variable to \fBPOWEROFF\fP. The script (usually \fI/etc/init.d/halt\fP) that calls
|
2018-11-15 22:58:35 +05:30
|
|
|
the \fBhalt\fP(8) program as the last thing in the shutting down sequence should
|
|
|
|
check this environment variable and call the \fBhalt\fP(8) program with
|
2009-09-10 13:58:49 +05:30
|
|
|
the right options for these options to actually have any effect.
|
|
|
|
.SH FILES
|
|
|
|
.nf
|
|
|
|
/fastboot
|
|
|
|
/etc/inittab
|
|
|
|
/etc/init.d/halt
|
|
|
|
/etc/init.d/reboot
|
|
|
|
/etc/shutdown.allow
|
|
|
|
.fi
|
|
|
|
.\"}}}
|
|
|
|
.SH NOTES
|
|
|
|
A lot of users forget to give the \fItime\fP argument
|
|
|
|
and are then puzzled by the error message \fBshutdown\fP produces. The
|
|
|
|
\fItime\fP argument is mandatory; in 90 percent of all cases this argument
|
|
|
|
will be the word \fBnow\fP.
|
|
|
|
.PP
|
2021-12-28 01:44:42 +05:30
|
|
|
\fBinit\fP(8) can only capture CTRL-ALT-DEL and start \fBshutdown\fP in console mode.
|
2009-09-10 13:58:49 +05:30
|
|
|
If the system is running the X window System, the X server processes
|
|
|
|
all key strokes. Some X11 environments make it possible to capture
|
|
|
|
CTRL-ALT-DEL, but what exactly is done with that event depends on
|
|
|
|
that environment.
|
|
|
|
.PP
|
2021-12-28 01:44:42 +05:30
|
|
|
\fBshutdown\fP wasn't designed to be run setuid. \fI/etc/shutdown.allow\fP is
|
2009-09-10 13:58:49 +05:30
|
|
|
not used to find out who is executing shutdown, it ONLY checks who
|
|
|
|
is currently logged in on (one of the) console(s).
|
|
|
|
.\"{{{ Author
|
|
|
|
.SH AUTHOR
|
2021-12-28 01:44:42 +05:30
|
|
|
.MT miquels@\:cistron\:.nl
|
|
|
|
Miquel van Smoorenburg
|
|
|
|
.ME
|
2009-09-10 13:58:49 +05:30
|
|
|
.\"}}}
|
|
|
|
.\"{{{ See also
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR fsck (8),
|
|
|
|
.BR init (8),
|
|
|
|
.BR halt (8),
|
|
|
|
.BR poweroff (8),
|
|
|
|
.BR reboot (8)
|
|
|
|
.\"}}}
|