精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學(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

        # 卸載遠程系統(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