リスト10■Apache自動起動スクリプト

#! /bin/sh
#
# Source function library.
. /etc/rc.d/init.d/functions
# Get config.
. /etc/sysconfig/network
# Check that networking is up.
if [ ${NETWORKING} = "no" ]
then
        exit 0
fi
# See how we were called.
case "$1" in
  start)
        echo -n "Starting httpd: "
        daemon /usr/local/apache/bin/httpd
        echo
        touch /var/lock/subsys/httpd
        ;;
  stop)
        echo -n "Stopping httpd: "
        killproc httpd
        echo
        rm -f /var/lock/subsys/httpd
        ;;
  status)
        status httpd
        ;;
  restart|reload)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: httpd {start|stop|status|restart}"
        exit 1
esac
exit 0