インストールする(その11)

OSブート時にApacheを起動する

coMomongaのブートと同時にApacheを起動するように設定する。
先ずは/etc/rc.d/init.d/httpdを以下の内容で作成し実行属性を付ける。

#!/bin/sh

CTL=/usr/local/apache/bin/apachectl

case "$1" in
    start|stop|restart)
        $CTL $1
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $?

次に実行レベルに合わせて/etc/rc.d/init.d/httpdとのシンボリックリンクを作成する。
通常の実行レベルは5であり、/sbin/runlevelコマンドを実行して調べることができる。

# cd /etc/rc.d/init.d
# chmod 755 httpd
# cd ../rc0.d
# ln -s ../init.d/httpd K85httpd
# cd ../rc1.d
# ln -s ../init.d/httpd K85httpd
# cd ../rc2.d
# ln -s ../init.d/httpd K85httpd
# cd ../rc3.d
# ln -s ../init.d/httpd K85httpd
# cd ../rc4.d
# ln -s ../init.d/httpd K85httpd
# cd ../rc5.d
# ln -s ../init.d/httpd S85httpd
# cd ../rc6.d
# ln -s ../init.d/httpd K85httpd

今回の設定では実行レベルが5以外でApacheを起動しないようにする。
試しにcoMomongaをシャットダウンしてブートして見よう。