File thttpd-initd.script of Package thttpd

#! /bin/sh
# Copyright (c) 1996-1999 SuSE Gmbh Nuernberg, Germany.  All rights reserved.
#
# /etc/init.d/thttpd
#
### BEGIN INIT INFO
# Provides: thttpd
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description:  thttpd
# Description: Starts the http daemon thttpd
### END INIT INFO

THTTPD_BIN=/usr/sbin/thttpd
test -x $THTTPD_BIN || exit 5

. /etc/rc.status

rc_reset

# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
# 
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.

case "$1" in
    start)
	echo -n "Starting service thttpd"
	startproc $THTTPD_BIN -C /etc/thttpd.conf
	rc_status -v
    ;;
    stop)
	echo -n "Shutting down service thttpd"
	killproc -TERM $THTTPD_BIN 
	rc_status -v
    ;;
    try-restart)
	## Stop the service and if this succeeds (i.e. the 
	## service was running before), start it again.
        $0 status >/dev/null &&  $0 restart
	# Remember status and be quiet
	rc_status
    ;;
    force-reload)
	## Stop the service and if this succeeds (i.e. the 
	## service was running before), start it again.
	$0 stop  && sleep 1 &&  $0 start
	# Remember status and be quiet
	rc_status
    ;;
    restart)
	$0 stop  
	sleep 1
	$0 start
	rc_status
    ;;
    reload)
	rc_failed 3 
	rc_status -v
    ;;
    status)
        echo -n "Checking for service thttpd: "
	checkproc $THTTPD_BIN
	rc_status -v
    ;;
    probe)
        #
    ;;
    *)
    echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
    exit 1
esac
rc_exit

openSUSE Build Service is sponsored by