# cd /etc/rc.d/init.d
# vi httpd
以下のスクリプトを記述します。
#!/bin/sh
#
# Startup script for the Apache 2.0 Web Server
#
# chkconfig: 345 85 15
# description: Starts and Stops the Apache 2.0 Web server.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
# See how we were called.
case "$1" in
start)
if [ -f /usr/local/apache2/bin/apachectl ]; then
echo -n "Starting httpd: "
daemon "/usr/local/apache2/bin/apachectl start"
echo
touch /var/lock/subsys/httpd
fi
;;
stop)
if [ -f /usr/local/apache2/bin/apachectl ]; then
echo -n "Shutting down httpd: "
daemon "/usr/local/apache2/bin/apachectl stop"
echo
rm -f /var/lock/subsys/httpd
rm -f /var/run/httpd.pid
fi
;;
status)
status httpd
;;
restart)
if [ -f /usr/local/apache2/bin/apachectl ]; then
echo -n "Restarting httpd: "
daemon "/usr/local/apache2/bin/apachectl restart"
echo
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
|