Blob Blame History Raw
#!/bin/bash
#
# innd		InterNet News System
#
# chkconfig: - 95 05
# description: inn is the most popular server for Usenet news. It allows \
#              you to setup local news servers. It can be difficult to \
#              set up properly though, so be sure to read /usr/share/doc/inn* \
#              before trying.
# processname: innd
# pidfile: /var/run/news/innd.pid

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

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
[ -d /etc/news ] || exit 0
[ -f /etc/news/inn.conf ] || exit 0
. /usr/lib/news/lib/innshellvars || exit 0
[ -d "$SPOOLBASE" ] || exit 0
[ -f "$HISTORY" -a -f "$HISTORY.hash" ] || {
	echo $"Please run makehistory and/or makedbz before starting innd." >&2
	exit 1
}

RETVAL=0

start() {
	echo -n $"Starting INND system: "
	# INN uses too many un-checked shell scripts
	unset LANG
	unset LC_COLLATE
        daemon --user news /etc/rc.news
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/innd
        echo
}

stop() {
        if [ -f /var/run/news/innd.pid ]; then
                echo -n $"Stopping INND service: "
                killproc innd
                RETVAL=$?
                [ $RETVAL -eq 0 ] && rm -f /var/run/news/innd.pid
                echo
        fi
        if [ -f /var/run/news/innwatch.pid ]; then
                echo -n $"Stopping INNWatch service: "
                killproc innwatch -9
                RETVAL=$?
                [ $RETVAL -eq 0 ] && rm -f /var/run/news/innwatch.pid
                echo
        fi
        if [ -f /var/run/news/innfeed.pid ]; then
                echo -n $"Stopping INNFeed service: "
                killproc innfeed -9
                RETVAL=$?
                [ $RETVAL -eq 0 ] && rm -f /var/run/news/innfeed.pid
                echo
        fi
        if [ -f /var/run/news/actived.pid ]; then
                echo -n $"Stopping INN actived service: "
                killproc actived -9
                RETVAL=$?
                [ $RETVAL -eq 0 ] && rm -f /var/run/news/actived.pid
                echo
        fi
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/innd /var/lock/news/*
}

reload() {
        echo -n $"Reloading INN Service: "
        killproc innd -HUP
        RETVAL=$?
}

restart() {
        stop
        start                                                                   
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
	status innd
        RETVAL=$?
	;;
  reload)
	#XXX fixme, not working
	#reload
	restart
	;;
  restart)
	restart
	;;
  condrestart)
	if [ -f /var/lock/subsys/innd ]; then
	    restart
	fi
	;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|condrestart}"
	exit 1
	;;
esac

exit $RETVAL