Listing 1: HTTPd startup script
#!/bin/sh
#
# Listing 1
# "http" -- HTTP daemon startup script
#
HTTP_DIR="/usr/local/etc/httpd"
HTTPD="$HTTP_DIR/httpd"
CONFIG_FILE="$HTTP_DIR/conf/httpd.conf"
PID_FILE="$HTTP_DIR/logs/httpd.pid"
case $1 in
start)
if ([ -x $HTTPD ]); then
$HTTPD -f $CONFIG_FILE
else
echo "$0: cannot execute \"$HTTPD\"" >&2
exit 2
fi ;;
stop)
if ([ -r $PID_FILE ]); then
kill -15 `cat $PID_FILE`
rm $PID_FILE
else
echo "$0: \"$HTTPD\" not running" >&2
exit 2
fi ;;
restart)
if ([ -r $PID_FILE ]); then
kill -1 `cat $PID_FILE`
else
echo "$0: \"$HTTPD\" not running" >&2
exit 2
fi ;;
*)
echo "$0: 'start', 'stop' or 'restart' ?" >&2
exit 2 ;;
esac
exit 0
# End of File
|