#!/bin/sh
#
# ircd       This shell script takes care of starting and stopping ircd.
#
# chkconfig: 234 75 30
# description: Internet Relay Chat Server.
#

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

# Source networking configuration.
. /etc/sysconfig/network

# Get service config
[ -f /etc/sysconfig/ircd ] && . /etc/sysconfig/ircd

# Check that networking is up.
if is_no "${NETWORKING}"; then
	msg_network_down IRCd
	exit 1
fi


# See how we were called.
case "$1" in
  start)
	# Start daemons.
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/ircd ]; then
		msg_starting "IRCd Server"
		daemon ircd -c
	else
		msg_already_running IRCd
		exit 1
	fi
	touch /var/lock/subsys/ircd
	;;
  stop)
	# Stop daemons.
	msg_stopping "IRCd Server"
	killproc ircd
	rm -f /var/run/ircd.pid
	rm -f /var/lock/subsys/ircd
	;;
  reload)
  	msg_reloading "IRCd Server"
	killproc ircd -HUP
	;;
  restart)
  	$0 stop
	$0 start
	;;
  status)
  	status ircd
	;;
  *)
	msg_usage "$0 {start|stop|restart|reload|status}"
	exit 1
esac

exit 0

