A system with SysV-init has a service installed called apache2. Which file controls the start and stop of this service and is referenced by the various runlevel directories?



A. /etc/init.d/apache2
B. /etc/rc2.d/70apache2
C. /etc/rc2.d/apache2
D. /etc/rc2.d/apache2.start

題解

SysV init的runlevel設定檔目錄為「/etc/rcX.d」或「/etc/init.d/rcX.d」,「X」為runlevel數值(0-9、A、B、C、S)。這個路徑下的設定檔為「/etc/init.d」下的設定檔的符號連結,檔名格式必須要以「S」或是「K」來開頭,再接上兩位數的優先權數值,再接上設定檔名稱。「S」表示執行(start),「K」表示中止(kill)。例如若要在runlevel 2時去中止「/etc/init.d/gpm」,就要在「/etc/rc2.d」中建立出「/etc/rc2.d/K30gpm」符號連結檔,其中的「30」是優先權值,數值愈小會愈先執行。

因此這題的答案是選項「A」。