Mar 31, 2009

Apacheの起動スクリプト

#!/bin/sh
# chkconfig: 345 98 20
# description: This shell script tabke care of starting and stopping httpd.
# processname: httpd
#
# httpd         This shell script takes care of starting and stopping
#               httpd.
#
# 

RETVAL=0
prog="/usr/local/apache2/bin/apachectl"

# See how we were called.
case "$1" in
  start)
        $prog startssl
        RETVAL=$?
        ;;
  stop)
        $prog stop
        RETVAL=$?
        ;;
  status)
        $prog status
        RETVAL=$?
        ;;
  restart|reload)
        $prog restart
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|status}"
        exit 1
esac

exit $RETVAL

chkconfigで自作の起動スクリプトを登録

# chkconfig: 345 98 20
# description: This shell script tabke care of starting and stopping httpd.
# processname: httpd

起動スクリプトのヘッダにchkconfig用の記述をする。 上から、ランレベル、起動優先順位、停止優先順位

/sbin/chkconfig --add httpd
/sbin/chkconfig --level 345 httpd on
/sbin/chkconfig --list
Edit this entry...

wikieditish message: Ready to edit this entry.
















A quick preview will be rendered here when you click "Preview" button.