File vdradmin.initd of Package vdradmin-am

#! /bin/sh
#
# LSB compatible service control script; see http://www.linuxbase.org/spec/
# 
### BEGIN INIT INFO
# Provides:          vdradmin
# Required-Start:    $syslog $remote_fs
# Should-Start:	     vdr
# Required-Stop:     $syslog $remote_fs
# Should-Stop:	     $null
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: vdradmin is a web interface to vdr
# Description:       Start vdradmin to provide a web
#	interface to vdr and auto-timer
### END INIT INFO

VDRADMIN_BIN=/usr/bin/vdradmind
# needed, because checkproc and friends don't like perl daemons
# (at least on openSUSE 11.1)
VDRADMIN_CHECKPROC=vdradmind
VDRADMIN_PID=/var/run/vdradmind.pid

# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
test -x $VDRADMIN_BIN || { echo "$VDRADMIN_BIN not installed"; 
	if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

# Source LSB init functions
#. /lib/lsb/init-functions

# Shell functions
. /etc/rc.status

# Locale information
. /etc/sysconfig/language
export LANG=${RC_LANG%.UTF-8}
export LC_ALL=${RC_LC_ALL%.UTF-8}

# Reset status of this service
rc_reset

case "$1" in
    start)
	echo -n "Starting vdradmin "
	$VDRADMIN_BIN
	rc_status -v
	;;
    stop)
	echo -n "Shutting down vdradmin "
	$VDRADMIN_BIN -k
	rc_status -v
	;;
    try-restart|condrestart)
	## 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)
	$0 stop
	$0 start
	rc_status
	;;
    force-reload)
	echo -n "Reload service vdradmin "
	/sbin/killproc -p $VDRADMIN_PID -HUP $VDRADMIN_CHECKPROC
	touch $VDRADMIN_PID
	rc_status -v
	;;
    reload)
	echo -n "Reload service vdradmin "
	/sbin/killproc -p $VDRADMIN_PID -HUP $VDRADMIN_CHECKPROC
	touch $VDRADMIN_PID
	rc_status -v
	;;
    status)
	echo -n "Checking for service vdradmin "
	/sbin/checkproc -p $VDRADMIN_PID $VDRADMIN_CHECKPROC
	rc_status -v
	;;
    probe)
	test /etc/vdradmin/vdradmin.conf -nt $VDRADMIN_PID && echo reload
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;
esac
rc_exit
openSUSE Build Service is sponsored by