apache 자동으로 시작시키는 방법

RedHat/chkconfig-compliant start script:

#!/bin/sh
#
# httpd      This shell script takes care of starting and stopping
#            httpd.
#
# chkconfig: 2345 65 35
# description: httpd provides support for updating dynamic DNS services.

PATH=/usr/sbin:/root/bin:${PATH}
export PATH

HTTPD='/usr/local/apache2/bin/httpd'

case "$1" in
  start)
        echo -n "Starting httpd: "
        $HTTPD -k $1
        echo
        ;;
  stop)
        echo -n "Shutting down httpd: "
        $HTTPD -k $1
        echo
        ;;
  restart)
        echo -n "Restarting httpd: "
        $HTTPD -k $1
        echo
        ;;
  *)
        echo "Usage: httpd {start|stop|restart|status}"
        exit 1
esac

exit 0

Save this file as "apache"

cp apache /etc/rc.d/init.d/

Add to chkconfig:

/sbin/chkconfig --add apache

Leave a Reply