File tircd.init.sh of Package tircd

#!/bin/sh
### BEGIN INIT INFO
# Provides:          tircd
# Required-Start:    $syslog $network $remote_fs
# Should-Start: $time
# Required-Stop:     $syslog $network $remote_fs
# Should-Stop: $time
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: tircd IRC-Twitter gateway server
# Description:       Start tircd to enable using a regular IRC
#   client for twittering.
### END INIT INFO

TIRCD_BIN="@@BINDIR@@/tircd"
TIRCD_CONFIG="@@CONFIG@@"
test -x "$TIRCD_BIN" || { echo "$TIRCD_BIN not installed"; 
	if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

test -r "$TIRCD_CONFIG" || { echo "$TIRCD_CONFIG not existing";
	if [ "$1" = "stop" ]; then exit 0;
	else exit 6; fi; }

. /etc/rc.status
rc_reset

case "$1" in
    start)
	echo -n "Starting tircd "
	/sbin/startproc -s -q "$TIRCD_BIN" "$TIRCD_CONFIG"
	rc_status -v
	;;
    stop)
	echo -n "Shutting down tircd "
	/sbin/killproc -TERM "$TIRCD_BIN"
	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 tircd "
	$0 try-restart
	rc_status
	;;
    reload)
	rc_failed 3
	rc_status -v
	;;
    status)
	echo -n "Checking for service tircd "
	/sbin/checkproc "$TIRCD_BIN"
	rc_status -v
	;;
    probe)
	test "$TIRCD_CONFIG" -nt /var/run/tircd.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