特黄特色三级在线观看免费,看黄色片子免费,色综合久,欧美在线视频看看,高潮胡言乱语对白刺激国产,伊人网成人,中文字幕亚洲一碰就硬老熟妇

學(xué)習(xí)啦>學(xué)習(xí)電腦>操作系統(tǒng)>Linux教程>

Linux系統(tǒng)中重啟命令如何使用

時間: 孫勝龍652 分享

  在進(jìn)行Linux系統(tǒng)操作的時候,如果出現(xiàn)更換硬件、更改系統(tǒng)配置及死機(jī)等情況時,就需要對電腦進(jìn)行重啟,而不同的情形重啟的方式也不同,即使用的命令不同,下面學(xué)習(xí)啦小編就給大家介紹下Linux下不同情形的重啟方法。

  不同于桌面系統(tǒng),作為服務(wù)器,我們較少對Linux系統(tǒng)進(jìn)行系統(tǒng)重啟,但在以下情形出現(xiàn)時,我們會對機(jī)器進(jìn)行重啟:

  更改系統(tǒng)配置

  系統(tǒng)僵死,需要重啟恢復(fù)

  更換硬件

  關(guān)閉和重啟系統(tǒng)方式

  引導(dǎo)系統(tǒng)本質(zhì)上只能用一種方法,與此不同的是,關(guān)閉或重新引導(dǎo)系統(tǒng)有多種方法:

  關(guān)閉電源(下電)

  使用shutdown命令

  使用halt、poweroff或reboot命令

  使用telinit改變init運行級別

  關(guān)閉電源

  基于以下兩點原因,直接對機(jī)器下電,并不是一種好的習(xí)慣:

  可能導(dǎo)致硬件損壞

  部分?jǐn)?shù)據(jù)可能仍在內(nèi)存,未被寫回磁盤,這時下電會丟失數(shù)據(jù)或造成文件系統(tǒng)損害;

  因而盡量使用其他方式關(guān)閉或重新引導(dǎo)系統(tǒng)。

  shutdown命令

  使用shutdown可以掛起(halt)或重啟(reboot)系統(tǒng),使用-h選項指示掛起系統(tǒng),起到與halt命令相同的作用;使用-r選項指示重啟系統(tǒng),起到與reboot命令相同的作用。

  執(zhí)行shutdown命令后,系統(tǒng)將向所有登陸用戶發(fā)送掛起或重啟消息。

  執(zhí)行shutdown –h now后發(fā)送掛起消息:

  代碼如下:

  [sql]

  # shutdown -h now]

  Broadcast message from root (tty1) (Thu May 3 10:58:22 2012):

  The system is going down for system halt NOW!

  INIT: Switching to runlevel: 0

  INIT: Sending processes the TERM signal

  執(zhí)行shutdown –r now后發(fā)送重啟消息:

  代碼如下:

  [sql]

  # shutdown -r now

  Broadcast message from root (tty1) (Thu May 3 11:18:22 2012):

  The system is going down for system reboot NOW!

  INIT: Switching to runlevel: 6

  INIT: Sending processes the TERM signal

  執(zhí)行shutdown后,其他用戶不能再登入系統(tǒng),另我們可以指定系統(tǒng)掛起或重啟的時間以及說明,如下兩例:

  凌晨1::00停機(jī)維護(hù):

  代碼如下:

  [sql]

  shutdown –h 1:00 “going down for scheduled maintenance. Expected downtime is 1 hour.”

  指定相對關(guān)機(jī)時間15分鐘后關(guān)機(jī):

  代碼如下:

  [sql]   shutdown –h +15 “going down for emergency check.”

  halt和reboot命令

  halt記錄關(guān)機(jī)情況,終止非必要進(jìn)程,執(zhí)行sync系統(tǒng)調(diào)用,等待文件系統(tǒng)寫操作完成,然后停止內(nèi)核,poweroff命令等價于halt.

  從以上“shutdown –h”和“shutdown –r”執(zhí)行輸出可知,執(zhí)行halt即進(jìn)入運行級別0,執(zhí)行reboot即進(jìn)入運行級別6,日志文件/var/log/messages中會記錄相應(yīng)日志。

  系統(tǒng)重啟日志:

  代碼如下:

  [sql]   May 3 11:45:25 slot14 shutdown[11119]: shutting down for system reboot

  May 3 11:45:25 slot14 init: Switching to runlevel: 6

  May 3 11:45:25 slot14 user_cmd: 2012-05-03 11:45:25 shutdown -r now by root from [root tty1 May 3 11:44]

  系統(tǒng)掛起日志:

  代碼如下:

  [sql]   May 3 10:50:22 slot14 shutdown[11561]: shutting down for system halt

  May 3 10:50:22 slot14 init: Switching to runlevel: 0

  May 3 10:50:22 slot14 user_cmd: 2012-05-03 10:50:22 shutdown -h now by root from [root tty1 May 3 10:48]

  通過查看/var/log/messages日志記錄,可判斷機(jī)器是無端重啟還是人為地重啟。

  telinit命令

  執(zhí)行telinit命令可以指引init進(jìn)入指定的運行級別,如重啟系統(tǒng):

  代碼如下:

  [sql]

  #telinit 6

  使用telinit時,不會得到像執(zhí)行shutdown那樣友好的警告信息,較少用作掛起和重啟命令,不過進(jìn)行/etc/inittab文件的修改服務(wù)器,重啟系統(tǒng)是比較大的動作。當(dāng)操作系統(tǒng)相關(guān)故障發(fā)生時,我們應(yīng)先考慮收集日志信息,必要時再進(jìn)行系統(tǒng)重啟。

  上面就是Linux下遇到不同情形的不同重啟方法的介紹了,重啟的命令有好多種,要應(yīng)用最恰當(dāng)?shù)拿顏碇貑C(jī)器,以防機(jī)器出錯。

307914