国产宅男网站在线|亚洲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>
    學習啦 > 學習電腦 > 操作系統(tǒng) > Linux教程 > 創(chuàng)建BSD啟動腳本/etc/rc.d/rc.sysinit

    創(chuàng)建BSD啟動腳本/etc/rc.d/rc.sysinit

    時間: 若木635 分享

    創(chuàng)建BSD啟動腳本/etc/rc.d/rc.sysinit

      創(chuàng)建BSD啟動腳本/etc/rc.d/rc.sysinit

      /etc/HOSTNAME一定要創(chuàng)建,下面腳本中要用,要不然下面會出錯。

      -----------------------------/etc/rc.d/rc.sysinit----------------------------

      #!/bin/sh

      #以只讀方式mount根系統(tǒng)

      echo "Mounting root device read-only..."

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

      # 掛載swap交換區(qū)

      echo "Initializing swap partitions..."

      /sbin/swapon -a

      # $?為命令返回值,1為錯誤。fsck檢查文件系統(tǒng)錯誤則重啟。

      /sbin/fsck -A -a -C

      if [ $? -gt 1 ]; then

      echo

      echo "ERROR:"

      echo "Your filesystem has been severely damaged. You can probably correct this"

      echo "problem by running e2fsck manually (eg. with the -v and -y options). After"

      echo "you logout, the system will reboot."

      echo

      PS1="(Repair filesystem)# "

      export PS1

      /sbin/sulogin

      /bin/umount -a -r

      /sbin/reboot -f

      fi

      # 以可讀寫方式重新mount文件系統(tǒng)。

      echo "Remounting root device read-write..."

      /bin/mount -n -v -o remount,rw /

      echo "" >/etc/mtab

      /bin/mount -f -o remount,rw /

      # 掛載其它本地文件系統(tǒng)。

      echo "Mounting other local filesystems..."

      /bin/mount -a -v -tnonfs

      # 設置主機名和域名。

      echo "Setting up hostname..."

      /bin/hostname `cat /etc/HOSTNAME |cut -d . -f1`

      /bin/domainname `cat /etc/HOSTNAME |cut -d . -f2-`

      # 隨機數(shù)設備

      if [ -f "/etc/random-seed" ]; then

      echo "Initializing random number generator..."

      /bin/cat /etc/random-seed >/dev/urandom

      rm -f /etc/random-seed

      fi

      echo "Loading keymap..."

      /usr/bin/loadkeys -d

      #設置系統(tǒng)時間

      echo "Setting system time from hardware clock..."

      /sbin/hwclock --hctosys --utc

      #開啟系統(tǒng)和內核日志服務

      echo "Starting system and kernel log daemons...."

      /usr/sbin/syslogd

      /usr/sbin/klogd -c3

      ### Use modules? If yes, uncomment this:

      # echo "Updating module dependencies..."

      # /sbin/depmod -a

      -------------------------end of /etc/rc.d/rc.sysinit-------------------------

    75548