Apache, MySQL init.d 스크립트 등록
1. 먼저 Apache 스크립트 등록
# cd /home/apache/bin/
# cp apachectl /etc/init.d/httpd
# chkconfig --add httpd
만약 chkconfig –add httpd 실행 시 에러가 발생한다면 방금 추가한 /etc/init.d/httpd 파일에 아래 코드를 추가한다.
#!/bin/sh
# chkconfig: 2345 90 90
# description: init file for Apache server daemon
# processname: httpd
# config: /home/apache/conf/httpd.conf
# pidfile: /home/apache/logs/httpd.pid
경로는 이 블로그의 호스팅에 맞게 수정한 상태이다. 수정 후 다시 chkconfig –add httpd 실행한다.
2. MySQL 스크립트 등록
# cd /home/mysql/support-files/
# cp mysql.server /etc/init.d/mysqld
# chkconfig --add mysqld
mysql.server 파일의 경로인 /home/mysql/support-files/는 MySQL 5.5에서의 경로이다. MySQL 5.1 버전에서는 /home/mysql/share/이다. 미니서버호스팅의 특성으로 Apache와 MySQL은 /home 디렉토리 아래에 설치가 되어 있는 상태이다.
이상으로 Apache, MySQL의 init.d 스크립트 등록이 끝났다. 이제 아래의 명령어로 서버 시작, 종료를 관리할 수 있다.
# service httpd start
# service httpd restart
# service httpd stop
# service mysqld start
# service mysqld restart
# service mysqld stop
리눅스 서버 관련 공부를 좀 해야할 듯 한데.. 귀찮아서 참 하는 게 쉽지가 않다.