⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shutdown.8

📁 sysvinit--linux系统下的init
💻 8
字号:
.\"{{{}}}.\"{{{  Title.TH SHUTDOWN 8 "November 12, 2003" "" "Linux System Administrator's Manual".\"}}}.\"{{{  Name.SH NAMEshutdown \- bring the system down.\"}}}.\"{{{  Synopsis.SH SYNOPSIS.B /sbin/shutdown.RB [ \-t.IR sec ].RB [ \-arkhncfFHP ].I time.RI [ warning-message ].\"}}}.\"{{{  Description.SH DESCRIPTION\fBshutdown\fP brings the system down in a secure way.  All logged-in users arenotified that the system is going down, and \fBlogin\fP(1) is blocked.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 thesignal \s-2SIGTERM\s0.  This gives programs like \fBvi\fP(1)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 usedto reboot the system, and runlevel \fB1\fP is used to put to system intoa state where administrative tasks can be performed; this is the defaultif neither the \fI-h\fP or \fI-r\fP flag is given to \fBshutdown\fP.To see which actions are taken on halt or reboot see the appropriateentries for these runlevels in the file \fI/etc/inittab\fP..\"}}}.\"{{{  Options.SH OPTIONS.\"{{{  -a.IP "\fB\-a\fPUse \fB/etc/shutdown.allow\fP..\"}}}.\"{{{  -t sec.IP "\fB\-t\fP \fIsec\fP"Tell \fBinit\fP(8) to wait \fIsec\fP seconds between sending processes the warning and the kill signal, before changing to another runlevel..\"}}}.\"{{{  -k.IP \fB\-k\fPDon't really shutdown; only send the warning messages to everybody..\"}}}.\"{{{  -r.IP \fB\-r\fPReboot after shutdown..\"}}}.\"{{{  -h.IP \fB\-h\fPHalt or poweroff after shutdown..\"}}}.\"{{{  -H.IP \fB\-H\fPHalt action is to halt or drop into boot monitor on systems thatsupport it..\"}}}.\"{{{  -P.IP \fB\-P\fPHalt action is to turn off the power..\"}}}.\"{{{  -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 whatyou'd expect..\"}}}.\"{{{  -f.IP \fB\-f\fPSkip fsck on reboot..\"}}}.\"{{{  -F.IP \fB\-F\fPForce fsck on reboot..\"}}}.\"{{{  -c.IP \fB\-c\fPCancel an already running shutdown. With this option it is of coursenot possible to give the \fBtime\fP argument, but you can enter aexplanatory message on the command line that will be sent to all users..\"}}}.\"{{{  time.IP \fItime\fPWhen to shutdown..\"}}}.\"{{{  warning-message.IP \fIwarning-message\fPMessage to send to all users..\"}}}.PPThe \fItime\fP argument can have different formats.  First, it can be anabsolute 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 thenumber of minutes to wait.  The word \fBnow\fP is an alias for \fB+0\fP..PPIf shutdown is called with a delay, it creates the advisory file.I /etc/nologinwhich causes programs such as \fIlogin(1)\fP to not allow new userlogins. Shutdown removes this file if it is stopped before itcan signal init (i.e. it is cancelled or something goes wrong).It also removes it before calling init to change the runlevel..PPThe \fB\-f\fP flag means `reboot fast'.  This only creates an advisoryfile \fI/fastboot\fP which can be tested by the system when it comesup again.  The boot rc file can test if this file is present, and decide not to run \fBfsck\fP(1) since the system has been shut down in the proper way.  After that, the boot process should remove \fI/fastboot\fP..PPThe \fB\-F\fP flag means `force fsck'.  This only creates an advisoryfile \fI/forcefsck\fP which can be tested by the system when it comesup again.  The boot rc file can test if this file is present, and decideto run \fBfsck\fP(1) with a special `force' flag so that even properlyunmounted filesystems get checked.After that, the boot process should remove \fI/forcefsck\fP..PPThe \fB-n\fP flag causes \fBshutdown\fP not to call \fBinit\fP, but to kill all running processes itself. \fBshutdown\fP will then turn off quota, accounting, and swappingand unmount all filesystems..\"}}}.\"{{{  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 accessto the console keyboard can shut the system down. To prevent this,\fBshutdown\fP can check to see if an authorized user is logged in onone of the virtual consoles. If \fBshutdown\fP is called with the \fB-a\fPargument (add this to the invocation of shutdown in /etc/inittab),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 peoplethat are logged in on a virtual console (from \fI/var/run/utmp\fP). Onlyif one of those authorized users \fBor root\fP is logged in, it willproceed. Otherwise it will write the message.sp 1.nf\fBshutdown: no authorized users logged in\fP.fi.sp 1to the (physical) system console. The format of \fI/etc/shutdown.allow\fPis 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 1Note that if \fI/etc/shutdown.allow\fP is not present, the \fB-a\fPargument is ignored..SH HALT OR POWEROFFThe \fB-H\fP option just sets the \fIinit\fP environment variable\fIINIT_HALT\fP to \fIHALT\fP, and the \fB-P\fP option just setsthat variable to \fIPOWEROFF\fP. The shutdown script that calls\fBhalt\fP(8) as the last thing in the shutdown sequence shouldcheck these environment variables and call \fBhalt\fP(8) withthe right options for these options to actually have any effect.Debian 3.1 (sarge) supports this..SH FILES.nf/fastboot/etc/inittab/etc/init.d/halt/etc/init.d/reboot/etc/shutdown.allow.fi.\"}}}.SH NOTESA lot of users forget to give the \fItime\fP argumentand are then puzzled by the error message \fBshutdown\fP produces. The\fItime\fP argument is mandatory; in 90 percent of all cases this argumentwill be the word \fBnow\fP..PPInit can only capture CTRL-ALT-DEL and start shutdown in console mode.If the system is running the X window System, the X server processesall key strokes. Some X11 environments make it possible to captureCTRL-ALT-DEL, but what exactly is done with that event depends onthat environment..PPShutdown wasn't designed to be run setuid. /etc/shutdown.allow isnot used to find out who is executing shutdown, it ONLY checks whois currently logged in on (one of the) console(s)..\"{{{  Author.SH AUTHORMiquel van Smoorenburg, miquels@cistron.nl.\"}}}.\"{{{  See also.SH "SEE ALSO".BR fsck (8),.BR init (8),.BR halt (8),.BR poweroff (8),.BR reboot (8).\"}}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -