關機命令有三個halt,shutdown,poweroff,以及重啓命令reboot halt確有其命令,以及man內容。 shutdown也是專門負責關機的命令,並是獨立的程序。 poweroff命令並不存在,但他直接調用的是halt -p的默認命令參數,是link過來的,下面我也提到了 reboot是重啓命令,做用內容能夠參考halt的man ...... [root@acnis root]# halt --help usage: halt [-n] [-w] [-d] [-f] [-i] [-p] -n: don't sync before halting the system -w: only write a wtmp reboot record and exit. -d: don't write a wtmp record. -f: force halt/reboot, don't call shutdown. -p: power down the system (if possible, otherwise halt) 參數說明: [-n] 防止 sync 系統調用,它用在用fsck修補根分區以後,以阻止內核用老版本的超級塊(superblock)覆蓋修補過的超級塊。 [-w] 並非真正的重啓或關機,只是寫 wtmp(/var/log/wtmp)紀錄。 [-d] 不寫 wtmp 紀錄(已包含在選項 [-n] 中)。 [-f] 沒有調用 shutdown 而強制關機或"重啓"(指的是reboot)。 [-i] 關機(或重啓)前,關掉全部的網絡接口。 [-p] 該選項爲缺省選項。就是關機時調用 poweroff。 (isher喜歡直接用poweroff命令) [-h] 在系統關閉以前,從系統中正確的移除全部的磁盤驅動器。 說明poweroff命令不少人不知道,這也是在/sbin下面的命令,是一個link,鏈接到halt -p的命令上。 [root@acnis sbin]# ll |grep pow lrwxrwxrwx 1 root root 4 2002-01-13 poweroff -> halt 爲了說明,MAN一下poweroff MAN poweroff(halt) 獲得如下內容,能夠做爲對照,對於halt -h 同時包含了halt命令和reboot的解釋,由於poweroff本就是halt的快捷方式而已(windows的話) NAME halt, reboot, poweroff - stop the system. SYNOPSIS /sbin/halt [-n] [-w] [-d] [-f] [-i] [-p] [-h] /sbin/reboot [-n] [-w] [-d] [-f] [-i] /sbin/poweroff [-n] [-w] [-d] [-f] [-i] [-h] OPTIONS -n Don't sync before reboot or halt. -w Don't actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file). -d Don't write the wtmp record. The -n flag implies -d. -f Force halt or reboot, don't call shutdown(8). -i Shut down all network interfaces just before halt or reboot. -h Put all harddrives on the system in standby mode just before halt or poweroff. -p When halting the system, do a poweroff. This is the default when halt is called as poweroff. [root@acnis root]# shutdown --help shutdown: invalid option -- - Usage: shutdown [-akrhfnc] [-t secs] time [warning message] -a: use /etc/shutdown.allow -k: don't really shutdown, only warn. -r: reboot after shutdown. -h: halt after shutdown. -f: do a 'fast' reboot (skip fsck). -F: Force fsck on reboot. -n: do not go through "init" but go down real fast. -c: cancel a running shutdown. -t secs: delay between warning and kill signal. ** the "time" argument is mandatory! (try "now") ** 參數說明 shutdown 命令能夠安全地關閉或重啓Linux系統,它在系統關閉以前給系統上的全部登陸用戶提示一條警告信息。該命令還容許用戶指定一個時間參數,能夠是一個精確 的時間,也能夠是從如今開始的一個時間段。精確時間的格式是hh:mm,表示小時和分鐘;時間段由「 」和分鐘數表示。系統執行該命令後,會自動進行數據同步的工做。 該命令的通常格式爲: shutdown [選項] [時間] [警告信息] 命令中各選項的含義爲: [-t] seconds : 設定在幾秒鐘以後進行關機程序 [-k] 並不真正關機,而只是發出警告信息給全部用戶。 [-r] 關機後當即從新啓動。 [-h] 關機後不從新啓動。 [-f] 快速關機,重啓動時跳過fsck。 [-F] : 關機時,強迫進行 fsck 動做 [-n] 快速關機,不通過init程序。 [-c] 取消一個已經運行的shutdown。 ×須要特別說明的是,該命令只能由超級用戶使用。 time : 設定關機的時間 message : 傳送給全部使用者的警告訊息 MAN shutdown 獲得如下內容,能夠做爲對照 NAME shutdown - bring the system down SYNOPSIS /sbin/shutdown [-t sec] [-arkhncfF] time [warning-message] OPTIONS -a Use /etc/shutdown.allow. -t sec Tell init(8) to wait sec seconds between sending processes the warning and the kill signal, before changing to another run- level. -k Don't really shutdown; only send the warning messages to every- body. -r Reboot after shutdown. -h Halt after shutdown. -n [DEPRECATED] Don't call init(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. -f Skip fsck on reboot. -F Force fsck on reboot. -c Cancel an already running shutdown. With this option it is of course not possible to give the time argument, but you can enter a explanatory message on the command line that will be sent to all users.
|