由 幸福的形狀 » 週一 3月 29, 2004 1:38 pm
#!/bin/bash
#
# apache Start the apache HTTP server.
#
# The variables below are NOT to be changed. They are there to make the
# script more readable. Look in /etc/defaults/apache for editable variables.
NAME=apache
+ NAME=apache
DAEMON=/usr/sbin/$NAME
+ DAEMON=/usr/sbin/apache
PIDFILE=/var/run/$NAME.pid
+ PIDFILE=/var/run/apache.pid
CONF=/etc/$NAME/httpd.conf
+ CONF=/etc/apache/httpd.conf
APACHECTL=/usr/sbin/${NAME}ctl
+ APACHECTL=/usr/sbin/apachectl
ENV="env -i LANG=C PATH=/bin:/usr/bin:/sbin:/usr/sbin"
+ ENV=env -i LANG=C PATH=/bin:/usr/bin:/sbin:/usr/sbin
trap "" 1
+ trap '' 1
# Check that we're not being started by inetd
if egrep -q -i "^[[:space:]]*ServerType[[:space:]]+inet" $CONF
then
exit 0
fi
+ egrep -q -i '^[[:space:]]*ServerType[[:space:]]+inet' /etc/apache/httpd.conf
test_config() {
if [ ! -x $APACHECTL ]; then
echo "$APACHECTL is not executable, exiting"
exit 0
fi
# ensure we don't leak environment vars into apachectl
APACHECTL="$ENV $APACHECTL"
if ! $APACHECTL configtest 2> /dev/null
then
printf "Configuration syntax error detected. Not reloading.\n\n"
$APACHECTL configtest
exit 1
fi
}
should_start() {
if [ ! -x $DAEMON ]; then
echo "apache is not executable, not starting"
exit 0
fi
}
case "$1" in
start)
should_start
test_config
echo -n "Starting web server: $NAME"
$ENV start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON > /dev/null
;;
stop)
echo -n "Stopping web server: $NAME"
start-stop-daemon --stop --pidfile $PIDFILE --oknodo
rm -rf /var/lib/apache/mod-bandwidth/link/*
;;
reload | force-reload)
test_config
echo -n "Reloading $NAME configuration"
start-stop-daemon --stop --pidfile $PIDFILE --signal USR1
;;
reload-modules)
test_config
echo -n "Reloading $NAME modules"
start-stop-daemon --stop --pidfile $PIDFILE --oknodo --retry 30
should_start
$ENV start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON > /dev/null
;;
restart)
test_config
echo -n "Restarting $NAME"
if ! start-stop-daemon -q --stop --pidfile $PIDFILE --signal HUP; then
$ENV start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON > /dev/
null
fi
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|reload|reload-modules|force-reloa
d|restart}"
exit 1
;;
esac
+ echo 'Usage: /etc/init.d/apache {start|stop|reload|reload-modules|force-reload
|restart}'
Usage: /etc/init.d/apache {start|stop|reload|reload-modules|force-reload|restart
}
+ exit 1
我以經重新移除,安裝過了,但是還不敢在reboot......