Linux Command – shutdown – xiaobin

shutdown(8) – Linux man pageNameshutdown – bring the system downSynopsisshutdown[OPTION]…TIME[MESSAGE]Descriptionshutdownarranges for the system to be brought down in a safe way. All logged-in users are notified that the system is going down and, within the last five minutes ofTIME, new logins are prevented.

TIMEmay have different formats, the most common is simply the word ‘now‘ which will bring the system down immediately. Other valid formats are+m, wheremis the number of minutes to wait until shutting down andhh:mmwhich specifies the time on the 24hr clock.

OnceTIMEhas elapsed,shutdownsends a request to theinit(8)daemon to bring the system down into the appropriate runlevel.

This is performed by emitting therunlevel(7)event, which includes the new runlevel in theRUNLEVELenvironment variable as well as the previous runlevel (obtained from the environment or from/var/run/utmp) in thePREVLEVELvariable. An additionalINIT_HALTvariable may be set, this will contain the valueHALTwhen bringing the system down for halt andPOWEROFFwhen bringing the system down for power off.

Options-rRequests that the system be rebooted after it has been brought down.-hRequests that the system be either halted or powered off after it has been brought down, with the choice as to which left up to the system.-HRequests that the system be halted after it has been brought down.-PRequests that the system be powered off after it has been brought down.-cCancels a running shutdown.TIMEis not specified with this option, the first argument isMESSAGE.-kOnly send out the warning messages and disable logins, do not actually bring the system down.EnvironmentRUNLEVELshutdownwill read the current runlevel from this environment variable if set in preference to reading from/var/run/utmpFiles/var/run/utmpWhere the current runlevel will be read from; this file will also be updated with the new runlevel./var/log/wtmpA new runlevel record will be appended to this file for the new runlevel.NotesThe Upstartinit(8)daemon does not keep track of runlevels itself, instead they are implemented entirely by its userspace tools.

Seerunlevel(7)for more details.

AuthorWritten by Scott James Remnant <scott@netsplit.com>Reporting BugsReport bugs at <https://launchpad.net/upstart/+bugs>CopyrightCopyright ? 2009 Canonical Ltd.This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See Alsorunlevel(7)init(8)telinit(8)reboot(8)Referenced Byapccontrol(8),boot(7),control-alt-delete(7),last(1),login(1),nologin(5),pidof(8),runlevel(8),shutdown_selinux(8),status(8),sudo(8),sync(8)

——————————————-示例———————

可以用shutdown -c命令取消下列的操作

1. 关机 (1)立刻关机

#shutdown -h now

(2)10分钟后自动关机

#shutdown -h 10

2. 重启 (1)立刻重启

#shutdown -r now

(2)过10分钟自动重启

#shutdown -r 10

(3)在时间为20:35时候重启

#shutdown -r 20:35

海内存知已,天涯若比邻。

Linux Command – shutdown – xiaobin

相关文章:

你感兴趣的文章:

标签云: