Blob Blame History Raw
#!/bin/bash
#
# ngircd        This shell script takes care of starting and stopping
#               the ngircd IRC daemon.
#
# chkconfig: - 80 30
# description: ngircd is an IRC daemon
# processname: ngircd
# pidfile: /var/run/ngircd/ngircd.pid
### BEGIN INIT INFO
# Provides: ngircd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Short-Description: start and stop the ngircd IRC daemon
# Description: ngircd is an IRC daemon
### END INIT INFO

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

prog=ngircd
RETVAL=0

mkdir -p /var/run/ngircd 2>/dev/null
chown ngircd /var/run/ngircd

start() {
        echo -n $"Starting $prog: "
        daemon ngircd
        RETVAL=$?
	echo
        [ $RETVAL = 0 ] && touch /var/lock/subsys/ngircd
        return $RETVAL
}

stop() {
	echo -n $"Stopping $prog: "
	killproc ngircd
	RETVAL=$?
	echo
	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/ngircd
}

reload() {
	echo -n $"Reloading $prog: "
	killproc ngircd -HUP
	RETVAL=$?
	echo
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
    status ngircd
	RETVAL=$?
	;;
  restart)
	stop
	start
	;;
  reload)
	reload
	;;
  condrestart)
	if [ -f /var/run/ngircd/ngircd.pid ] ; then
		stop
		start
	fi
	;;
  *)
	echo $"Usage: $prog {start|stop|restart|reload|condrestart|status|help}"
	exit 1
esac

exit $RETVAL