You have written a little startup script (/usr/local/bin/startup.sh) that should automatically execute when entering runlevel 3. According to the standards, how can this best be achieved?



A. chmod 700 /usr/local/bin/startup.sh; cd /etc/init.d/rc3.d/; ln -s /user/local/bin/startup.sh
B. chmod 700 /usr/local/bin/startup.sh; cd /etc/init.d/rc3.d/; ln -s /usr/local/bin/startup.sh S99startup.sh
C. chmod 700 /usr/local/bin/startup.sh; cd /etc/init.d/rc3.d/; ln /user/local/bin/startup.sh
D. chmod 700 /usr/local/bin/startup.sh; cd /etc/init.d/rc3.d/; ln -s /user/local/bin/startup.sh /usr/locl/bin/startup.sh
E. chmod 700 /usr/local/bin/startup.sh; cp /user/local/bin/startup.sh /etc/init.d/rc3.d/S99Startup.sh

題解

在SysVinit系統中,若要設定進入特定的runlevel時要執行哪些腳本的話,需要在「/etc/init.d/rc<X>.d/」目錄中進行設定(<X>為runlevel的號碼),後期則是在「/etc/rc<X>.d/」目錄中進行設定。將要執行的script建立連結至該目錄中,如果是用來啟動服務的話,應以「S」(Start)為檔案名稱開頭;如果是要中止服務的話,應以「K」(Kill)為檔案名稱開頭。在「S」或「K」之後使用數字來控制執行的順序,數字愈大者愈後面才會被執行到。

所以這題答案是選項B。