본문 바로가기

Linux/Study

apache 서비스 등록

ntsysv 에 등록을 하시려면 일단 chkconfig 쪽에 올라와야합니다.

우선 /etc/init.d로 이동하셔서 vi httpd 하신다음에요.

아래 내용을 복사해서 붙이세요

#!/bin/bash
#
# chkconfig: - 50 50
# description: init file for Apache2 server daemon

# processname: /usr/local/apache2/apachectl
# config:      /usr/local/apache2/conf/httpd.conf
# pidfile:     /usr/local/apache2/logs/httpd.pid
#
# source function library
. /etc/rc.d/init.d/functions

# pull in sysconfig settings

RETVAL=0
prog="apaceh2"

# Some functions to make the below more readable
APACHE2_HOME=/usr/local/apache2
APACHED=$APACHE2_HOME/bin/apachectl

start()
{
       # Create keys if necessary
       echo -n $"Starting $prog :"
       sh $APACHED start && success || failure
       RETVAL=$?
       return $RETVAL
}

stop()
{
       echo -n $"Stopping $prog:"
       sh  $APACHED stop && success || failure
       RETVAL=$?
       return $RETVAL
}


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

다음에 chkconfig --add httpd 하시고, chkconfig --list 하셔서 목록에 올라와 있느지 확인을 해보세요. 올라와 있는것을 확인하셨을면 다시 chkconfig --level 3 httpd 라고 하시면, runlevel 3 부분에 한해서 실행이 되게 됩니다.

그담에 ntsysv 해 보시면 httpd 라고 올라와 있을 것입니다

'Linux > Study' 카테고리의 다른 글

inode  (0) 2008.10.09
특수문자로 퍼미션 설정하기  (0) 2008.10.09
crontab 기본 설정 명령어  (0) 2008.10.09
리눅스 디렉토리별 개괄적 요약  (0) 2008.10.09
useradd 명령어 수행과정  (0) 2008.10.09