File httpd.init of Package httpd24

#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          httpd
# Required-Start:    $syslog $remote_fs
# Should-Start: $time ypbind
# Required-Stop:     $syslog $remote_fs
# Should-Stop: $time ypbind
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: Apache HTTP daemon
# Description:       Start the Apache HTTP daemon
### END INIT INFO
# 


# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
HTTPD_BIN=/usr/sbin/httpd
PID_DIR=/var/run/httpd
PID_FILE=${PID_DIR}/httpd.pid
test -x $HTTPD_BIN || { echo "$HTTPD_BIN not installed"; 
	if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }
if [ ! -d ${PID_DIR} ]; then
    if ! mkdir ${PID_DIR}; then
	echo "Could not create directory ${PID_DIR}" >&2
	exit 5
    fi
fi

# Source LSB init functions
# providing start_daemon, killproc, pidofproc, 
# log_success_msg, log_failure_msg and log_warning_msg.
. /etc/rc.status

# Reset status of this service
rc_reset


case "$1" in
    start)
	echo -n "Starting httpd "
	$HTTPD_BIN -k start
	rc_status -v
	;;
    stop)
	echo -n "Shutting down httpd "
	$HTTPD_BIN -k stop
	rc_status -v
	;;
    try-restart|condrestart)
	## Do a restart only if the service was active before.
	## Note: try-restart is now part of LSB (as of 1.9).
	## RH has a similar command named condrestart.
	if test "$1" = "condrestart"; then
		echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
	fi
	$0 status
	if test $? = 0; then
		$0 restart
	else
		rc_reset	# Not running is not a failure.
	fi
	# Remember status and be quiet
	rc_status
	;;
    restart)
	## Stop the service and regardless of whether it was
	## running or not, start it again.
	$HTTPD_BIN -k restart
	rc_status
	;;
    reload|force-reload)
	## Signal the daemon to reload its config.
	$HTTPD_BIN -k graceful
	rc_status -v
	;;
    status)
	echo -n "Checking for service httpd "
	## Check status with checkproc(8), if process is running
	## checkproc will return with exit status 0.
	/sbin/checkproc $HTTPD_BIN
	rc_status -v
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
	exit 1
	;;
esac
rc_exit
openSUSE Build Service is sponsored by