File init.quasselcore of Package quassel

#!/bin/sh
### BEGIN INIT INFO
# Provides:          quasselcore
# Required-Start:    $syslog $remote_fs $network
# Should-Start:      $time $named
# Required-Stop:     $syslog $remote_fs $network
# Should-Stop:       $null 
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: quassel core daemon
# Description:       Start quassel core
### END INIT INFO


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

# Check for existence of needed config file and read it
QUASSELCORE_CONFIG=/etc/sysconfig/quasselcore
test -r $QUASSELCORE_CONFIG || { echo "$QUASSELCORE_CONFIG not existing";
	if [ "$1" = "stop" ]; then exit 0;
	else exit 6; fi; }

# Read config	
. $QUASSELCORE_CONFIG

QUASSELCORE_USERID=quasselcore
QUASSELCORE_GROUPID=quasselcore
: ${QUASSELCORE_LISTEN:=127.0.0.1}

. /etc/rc.status

# Reset status of this service
rc_reset

case "$1" in
    start)
	echo -n "Starting quassel core"
	/sbin/startproc -u ${QUASSELCORE_USERID} -g ${QUASSELCORE_GROUPID} \
            $QUASSELCORE_BIN --configdir=/var/lib/quasselcore --listen="${QUASSELCORE_LISTEN/ /,}" \
                --logfile=/var/log/quassel/quasselcore &>/var/log/quassel/rcquasselcore.out
	rc_status -v
	;;
    stop)
	echo -n "Shutting down quassel core"
	/sbin/killproc -TERM $QUASSELCORE_BIN
	sleep 1
	rc_status -v
	;;
    try-restart|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
	rc_status
	;;
    restart)
	$0 stop
	$0 start
	rc_status
	;;
    force-reload)
	echo -n "Reload service quassel core"
	## if it supports it:
	#/sbin/killproc -HUP $QUASSELCORE_BIN
	#touch /var/run/FOO.pid
	#rc_status -v

	## Otherwise:
	$0 try-restart
	#rc_status
	;;
    reload)
	#echo -n "Reload service quassel core"
	#/sbin/killproc -HUP $QUASSELCORE_BIN
	#touch /var/run/FOO.pid
	#rc_status -v
	
	## Otherwise if it does not support reload:
	rc_failed 3
	#rc_status -v
	;;
    status)
	echo -n "Checking for service quassel core"
	/sbin/checkproc $QUASSELCORE_BIN
	rc_status -v
	;;
    probe)
	#test /var/lib/quasselcore/quasselcore.conf -nt /var/run/quasselcore.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