#! /bin/sh
# Copyright (c) 1996 S.u.S.E. GmbH Fuerth, Germany.  All rights reserved.
#
# Author: slr@suse.de
#
# /sbin/init.d/ircd
#

. /etc/rc.config

# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}

# Force execution if not called by a runlevel directory.
test $link = $base && START_IRCD="yes"
test "$START_IRCD" = yes || exit 0

# The echo return value for success (defined in /etc/rc.config).
return=$rc_done


case "$1" in
    start)
        echo -n "Starting service ircd"
        /bin/su irc -c '/sbin/startproc /usr/sbin/ircd' || return=$rc_failed
        echo -e "$return"
        ;;
    stop)
        echo -n "Shutting down service ircd"
        killproc -TERM /usr/sbin/ircd || return=$rc_failed
        echo -e "$return"
        ;;
    reload)
        echo -n "Reload service ircd"
        killproc -f /usr/lib/ircd/ircd.pid -HUP /usr/sbin/ircd || return=$rc_failed
        echo -e "$return"
        ;;
    status)
        echo -n "Checking for service ircd "
        checkproc /usr/sbin/ircd && echo -e "OK" || echo -e "No process"
        ;;
    *)
        echo "Usage: $0 {start|stop|reload|status}"
        exit 1
esac


# Inform the caller not only verbosely and set an exit status.
test "$return" = "$rc_done" || exit 1
exit 0


