#! /bin/sh
# Copyright (c) 1995-2002 SuSE Linux AG Nuernberg, Germany.
#
# Author: 	slr@suse.de
#		olh@suse.de
#
# /etc/init.d/ircd
#
#   and symbolic its link
#
# /sbin/rcircd
#
### BEGIN INIT INFO
# Provides: 		ircd
# Required-Start:	$network $local_fs $syslog
# Required-Stop:
# Default-Start:	3 5
# Default-Stop: 1 2
# Description:		irc daemon
### END INIT INFO

. /etc/rc.status

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status

IRCD_BIN=/usr/sbin/ircd

# First reset status of this service
rc_reset
case "$1" in
    start)
	echo -n "Starting service ircd"
	startproc $IRCD_BIN

	# Remember status and be verbose
	rc_status -v
	;;
    stop)
	echo -n "Stopping service ircd"

	killproc -TERM $IRCD_BIN

	# Remember status and be verbose
	rc_status -v
	;;
    try-restart)
        $0 status >/dev/null && $0 restart

        # Remember status and be quiet
	rc_status
	;;
    restart)
	## If first returns OK call the second, if first or
	## second command fails, set echo return value.
	$0 stop && sleep 2 && $0 start

	# Remember status and be quiet
	rc_status
	;;
    force-reload)
	## Exclusive possibility: Some services must be stopped
	## and started to force a new load of the configuration.

	echo -n "Reload service ircd"
	killproc -HUP $IRCD_BIN

	# Remember status and be verbose
	rc_status -v
	;;
    reload)
	## Exclusive possibility: Some services must be stopped
	## and started to force a new load of the configuration.

	echo -n "Reloading service ircd"
	killproc -HUP $IRCD_BIN

	# Remember status and be verbose
	rc_status -v
	;;
    status)
	echo -n "Checking for service ircd: "
	## Check status with checkproc(8), if process is running
	## checkproc will return with exit status 0.

	checkproc $IRCD_BIN
	rc_status -v
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
	exit 1
	;;
esac
rc_exit
