国产宅男网站在线|亚洲A级性爱免费视频|亚洲中精品级在线|午夜福利AA毛

  • <dd id="gf5jf"><th id="gf5jf"></th></dd>

    <cite id="gf5jf"><label id="gf5jf"></label></cite>
  • <div id="gf5jf"><listing id="gf5jf"></listing></div>
    學(xué)習(xí)啦 > 學(xué)習(xí)電腦 > 操作系統(tǒng) > Linux教程 >

    BSD關(guān)機重啟腳本/etc/rc.d/rc.0

    時間: 若木635 分享

      BSD關(guān)機重啟腳本/etc/rc.d/rc.0

      #!/bin/sh

      # 關(guān)閉所有程序

      echo "Sending all processes the TERM signal..."

      /sbin/killall5 -15

      sleep 1

      echo "Sending all processes the KILL signal..."

      /sbin/killall5 -9

      sleep 1

      # 卸載swap

      echo "Deactivating swap partitions..."

      /sbin/swapoff -a

      # 保存隨想數(shù)種子

      echo "Saving random seed to a temporary file..."

      /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null

      # 保存系統(tǒng)時鐘

      echo "Saving the system time to hardware clock..."

      /sbin/hwclock --systohc --utc

      # 卸載遠(yuǎn)程系統(tǒng)

      echo "Unmounting remote filesystems..."

      /bin/umount -a -f -tnfs

      # -w參數(shù)并不會真的重開機,只是把記錄寫到 /var/log/wtmp 檔案里

      # 0級和6級這里是一個文件,通過腳本名來判斷是關(guān)機還是重啟,所以有了下面結(jié)構(gòu)。

      case "$0" in

      *6)

      /sbin/reboot -w

      ;;

      *0)

      /sbin/halt -w

      ;;

      esac

      # 以只讀方式掛載系統(tǒng)

      echo "Remounting root filesystem read-only..."

      /bin/mount -n -o remount,ro /

      #將刷新緩存,保存數(shù)據(jù)

      echo "Flushing filesystem buffers..."

      /bin/sync

      #卸載本地文件系統(tǒng)

      echo "Unmounting local filesystems..."

      /bin/umount -a -tnonfs

      # 關(guān)機

      case "$0" in

      *6)

      echo "Please stand by while rebooting..."

      /sbin/reboot -d -f -i

      ;;

      *0)

      echo "Bye..."

      /sbin/halt -d -f -p

      ;;

      esac

    75556