글목록

2014. 3. 7.

[CentOS 6.4] Apache 자동 실행 (서비스 데몬등록)



# cd /etc/init.d

# vi apache



#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /etc/httpd/conf/access.conf
# config: /etc/httpd/conf/httpd.conf
# config: /etc/httpd/conf/srm.conf

# Source function library.
. /etc/rc.d/init.d/functions

# See how we were called.
case "$1" in
  start)
    LS_COLORS=""
    CLASSPATH=""
    echo -n "Starting httpd: "
    #daemon httpd
    #daemon  /usr/local/apache/bin/apachectl startssl
    daemon  /usr/local/apache/bin/apachectl start
    echo
    touch /var/lock/subsys/httpd
    ;;
  stop)
    echo -n "Shutting down http: "
    killproc httpd
    echo
    rm -f /var/lock/subsys/httpd
    rm -f /var/run/httpd.pid
    ;;
  status)
    status httpd
    ;;
  restart)
    $0 stop
    sleep 2
    $0 start
    ;;
  reload)
    echo -n "Reloading httpd: "
    killproc httpd -HUP
    echo
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|reload|status}"
    exit 1
esac

exit 0

댓글 없음:

댓글 쓰기