#!/bin/sh
#
# ircd		This start and stops the IRC server
#
# chkconfig:	345 97 03
# description:	ircd is the server (daemon) program for the Internet \
#		Relay Chat Program. The ircd is a server in that its \
#		function is to "serve" the client program irc(1) with \
#		messages and commands. All commands and user messages \
#		are passed directly to the ircd for processing and \
#		relaying to other ircd sites.
#
# processname: /usr/sbin/ircd
# config: /var/ircd/etc/ircd.conf
# pidfile: /var/ircd/run/ircd.pid

PATH=/sbin:/bin:/usr/bin:/usr/sbin

# Source function library.
. /etc/init.d/functions

# Get config.
test -f /etc/sysconfig/network && . /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "yes" ] || exit 0

[ -x /usr/sbin/ircd ] || exit 1
[ -r /etc/ircd/ircd.conf ] || exit 1

RETVAL=0

start(){
    echo -n "Starting ircd: "
    daemon /usr/sbin/ircd
    RETVAL=$?
    echo
    touch /var/lock/subsys/ircd
    return $RETVAL
}

stop(){
    echo -n "Stopping ircd: "
    killproc ircd
    RETVAL=$?
    echo
    rm -f /var/lock/subsys/ircd
    return $RETVAL
}

reload(){
    echo -n "Reloading configuration: " 
    killproc ircd -HUP
    RETVAL=$?
    echo
    return $RETVAL
}

restart(){
    stop
    start
}

condrestart(){
    [ -e /var/lock/subsys/ircd ] && restart
    return 0
}


# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status ircd
        ;;
    restart)
        restart
        ;;
    reload)
        reload
        ;;
    condrestart)
        condrestart
        ;;
    *)
        echo "Usage: ircd {start|stop|status|restart|condrestart|reload}"
        RETVAL=1
esac

exit $RETVAL



	echo "Usage: $0 {start|stop|status|restart}"
	exit 1
esac

exit 0
