如何启动时加载apache(UNIX/LINUX)?

我在RH9X下新安装了APACHE,请问怎样把APACHE加到运行等级里面去,让系统启动时就启动APACHE.
---------------------------------------------------------------

把这个加在/etc/rc.d/rc.local
/usr/local/apache/bin/apachectl start
上面的路径写你自己安装APACHE的路径
重新启动机器就可以启动APACHE了

还有另外的方法就是写启动脚本
放到INIT。D里面,然后加CHKCONFIG来加启动于你的RC3。D里面
也可以的

===============================================

#!/bin/sh

Startup script for the Apache Web Server

chkconfig: 345 85 15

description: Apache is a World Wide Web server. It is used to serve \

HTML files and CGI.

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)
echo -n "Starting httpd: "


daemon httpd

/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
$0 start
;;
reload)
echo -n "Reloading httpd: "
killproc httpd -HUP
echo
;;
*)
echo "Usage: $0 {start &brvbarstop &brvbarrestart &brvbarreload &brvbarstatus}"
exit 1
esac

exit 0

Published At
Categories with Web编程
comments powered by Disqus