#
# innd InterNet News System
#
-# chkconfig: 345 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/doc/inn* \
-# before trying.
+# chkconfig: 345 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/doc/inn* \
+# before trying.
# Source function library.
. /etc/rc.d/init.d/functions
. /usr/share/news/innshellvars
# Check that networking is up.
-[ "${NETWORKING}" = "no" ] && exit 0
+if is_yes "${NETWORKING}"; then
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+ msg_network_down "INN"
+ exit 1
+ fi
+else
+ exit 0
+fi
-# See how we were called.
-case "$1" in
- start)
+start() {
if [ ! -f /var/lock/subsys/inn ]; then
- show Starting INN service
- daemon inndstart
- if `echo $DOINNWATCH | grep -q -e "[tTyY].*"`; then
- show Starting INN Watch service
- busy
- su - news -c "/usr/bin/innwatch &"
- if ps ax | grep -v grep | grep -q innwatch; then
- deltext;ok
- else
- deltext;fail
+ grep -v "#" /etc/news/inn.conf | grep ovmethod | grep ovdb 2>&1 >/dev/null
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ msg_starting "INN ovdb_monitor"
+ daemon --pidfile /var/run/news/ovdb_monitor.pid --user news ovdb_init
+ fi
+
+ msg_starting "INN"
+ daemon --pidfile /var/run/news/innd.pid --user news innd
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/inn
+ if is_yes "$DOINNWATCH" ; then
+ msg_starting "INN Watch"
+ busy
+ daemon --fork --pidfile /var/run/news/innwatch.pid --user news /usr/bin/innwatch
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/innwatch
fi
- fi
else
- echo 'INND is running'
- fi
- touch /var/lock/subsys/inn
- ;;
- stop)
- if [ -f /var/run/news/innd.pid ]; then
- show Stopping INN service
- killproc innd
- rm -f /var/run/news/innd.pid
+ msg_already_running "INN"
fi
+}
- if [ -f /var/run/news/innwatch.pid ]; then
- show Stopping INN Watch service
- busy
- if killall -9 innwatch; then
- deltext;ok
- else
- deltext;died
- fi
- rm -f /var/run/news/innwatch.pid /var/run/news/LOCK.innwatch
- fi
+stop() {
+ if [ -f /var/lock/subsys/inn ]; then
+ msg_stopping "INN"
+ busy
+ if ctlinnd shutdown "Stopping INN service"; then
+ ok
+ else
+ fail
+ fi
- if [ -f /var/run/news/infeed.pid ]; then
- show Stopping INN Feed service
- killproc innfeed -9
- rm -f /var/run/news/innfeed.pid
- fi
+ if [ -f /var/run/news/innwatch.pid ]; then
+ msg_stopping "INN Watch"
+ killproc --pidfile /var/run/news/innwatch.pid innwatch -9
+ rm -f /var/run/news/innwatch.pid \
+ /var/run/news/LOCK.innwatch >/dev/null 2>&1
+ fi
- if [ -f /var/run/news/actived.pid ]; then
- show Stopping INN Actived service
- killproc actived -9
- rm -f /var/run/news/actived.pid
+ if [ -f /var/run/news/infeed.pid ]; then
+ msg_stopping "INN Feed"
+ killproc --pidfile /var/run/news/infeed.pid innfeed -9
+ rm -f /var/run/news/innfeed.pid >/dev/null 2>&1
+ fi
+
+ if [ -f /var/run/news/actived.pid ]; then
+ msg_stopping "INN Actived"
+ killproc --pidfile /var/run/news/actived.pid actived -9
+ rm -f /var/run/news/actived.pid >/dev/null 2>&1
+ fi
+
+ if [ -f /var/run/news/ovdb_monitor.pid ]; then
+ msg_stopping "INN ovdb_monitor"
+ killproc --pidfile /var/run/news/ovdb_monitor.pid ovdb_monitor -15
+ rm -f /var/run/news/ovdb_monitor.pid >/dev/null 2>&1
+ fi
+
+ rm -f /var/lock/subsys/inn >/dev/null 2>&1
+
+ else
+ msg_not_running INN
fi
+}
- rm -f /var/lock/subsys/inn
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
;;
status)
+ status innwatch
status innd
+ if [ $? -eq 0 ]; then
+ innstat
+ fi
;;
- reload)
- show Reloading INND service
- killproc innd -HUP
+ reload|force-reload)
+ if [ -f /var/lock/subsys/inn ]; then
+ msg_reloading "INN"
+ busy
+ ctlinnd reload all "Reloading" >/dev/null 2>&1;
+ [ $? -ne 0 ] && RETVAL=7
+ [ $RETVAL -eq 0 ] && ok || died
+ else
+ msg_not_running INN >&2
+ exit 7
+ fi
;;
restart)
- $0 stop
- $0 start
+ stop
+ sleep 2
+ start
;;
*)
- echo "Usage: $0 {start|stop|status|restart}"
- exit 1
- ;;
+ msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+ exit 3
esac
-exit 0
+exit $RETVAL