init.d に apacheを登録する

  1. やること
    1. /etc/init.d/ へapacheスクリプトを配置する
    2. chkconfigでランレベルを設定する


(例) apachectlを/etc/init.dへ配置する(Apache を prefix=/usr/local/apache でインストール済みとする)

$ su
# cp /usr/local/apache/bin/apachectl /etc/init.d/apachectl
# vi /etc/init.d/apachectl
+# chkconfig: - 85 15
+# description: Apache is a World Wide Web server.  It is used to serve \
+#              HTML files and CGI.


chkconfigでランレベルを設定する

# /sbin/chkconfig --add apache
# /sbin/chkconfig apache on
apache         0:オフ  1:オフ  2:オフ  3:オン  4:オン  5:オン  6:オフ

ワンポイント - 配置するスクリプト内にchkconfig用の記述を追加する。
追加していないと↓のエラーが出力される

service apache does not support chkconfig