next up previous contents
Next: 線上求助 Up: 文字命令 Previous: 指令下達   Contents

正確的關機

  1. Linux 為多人多工環境,螢幕背後可能有多人或多個服務正在工作,不正常關機可能造成檔案系統毀損。
  2. who:查看誰在線上。
    [root@dywHome2 ~]# who
    dywang   tty1         2008-09-07 06:00
    
  3. shutdown:通知線上使用者關機的時刻後關機。
    [root@mdk-dyw ~]# shutdown
    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") **
    [root@mdk-dyw ~]# shutdown -h now
    [root@mdk-dyw ~]# shutdown -h 00:05
    [root@mdk-dyw ~]# shutdown -h +30
    [root@mdk-dyw ~]# shutdown -r now
    [root@mdk-dyw ~]# shutdown -r +30 'The system will reboot'
    [root@mdk-dyw ~]# shutdown -k now 'This system will reboot'
    
  4. halt:關機。
    [root@mdk-dyw ~]# halt
    
  5. reboot:重新開機。
    [root@mdk-dyw ~]# reboot
    



2015-04-13