]> git.pld-linux.org Git - packages/inn.git/blobdiff - inn.init
- release 14
[packages/inn.git] / inn.init
index ee8f44bb1c35ac6efdfb4eb3e1ba03ca9b4a73a2..2d22ed6cca3135ca304b45bd7e1746ce602601d6 100644 (file)
--- a/inn.init
+++ b/inn.init
@@ -2,11 +2,11 @@
 #
 # 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_no "${NETWORKING}"; then
+       msg_Network_Down "INN"
+       exit 1
+fi
+                       
 
 # See how we were called.
 case "$1" in
   start)
-       if [ ! -f /var/lock/subsys/crond ]; then
-           if [ ! -f ${SERVERPID} ] ; then
-               show Starting INN service
-               daemon ${INNDSTART} ${INNFLAGS}
-           else
-               show Starting INN service
-               daemon ${INNDSTART} -r ${INNFLAGS}
-           fi
+       if [ ! -f /var/lock/subsys/inn ]; then
+               msg_starting "INN"
+               daemon su - news -c inndstart
+               if is_yes $DOINNWATCH ; then
+                       msg_starting "INN Watch"
+                       busy
+                       su - news -c "umask 002 ; /usr/bin/innwatch &"
+                       RETVAL=$?
+                       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/inn
+                       if ps -C innwatch >/dev/null 2>&1; then
+                               deltext;ok
+                       else
+                               deltext;fail
+                       fi
+               else
+                       touch /var/lock/subsys/inn
+               fi
        else
-           echo 'INND is running'
+               msg_Already_Running "INN"
+               exit 1
        fi
-       touch /var/lock/subsys/inn
        ;;
   stop)
-       show Stopping INND service
-       killproc innd
-       rm -f /var/lock/subsys/inn
+       if [ -f /var/lock/subsys/inn ]; then
+               msg_stopping "INN"
+               busy
+               if ctlinnd shutdown "Stopping INN service";then
+                       deltext;ok
+               else
+                       deltext;fail
+               fi
+
+               if [ -f /var/run/news/innwatch.pid ]; then
+                       msg_stopping "INN Watch"
+                       busy
+                       if killall -9 innwatch; then
+                               deltext;ok
+                       else
+                               deltext;died
+                       fi
+                       rm -f /var/run/news/innwatch.pid \
+                       /var/run/news/LOCK.innwatch >/dev/null 2>&1
+               fi
+
+               if [ -f /var/run/news/infeed.pid ]; then
+                       msg_stopping "INN Feed"
+                       killproc 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 actived -9
+                       rm -f /var/run/news/actived.pid >/dev/null 2>&1
+               fi
+
+       else
+               msg_Not_Running INN
+               exit 1
+       fi
+       rm -f /var/lock/subsys/inn >/dev/null 2>&1
        ;;
   status)
        status innd
        ;;
   reload)
-        show Reloading INND service
-       killproc innd -HUP
+       if [ -f /var/lock/subsys/inn ]; then
+               msg_reloading "INN"
+               busy
+               if ctlinnd reload all "Reloading" >/dev/null 2>&1; then
+                       deltext;ok
+               else
+                       deltext;fail
+               fi
+       else
+               msg_Not_Running INN
+               exit 1
+       fi
        ;;
   restart)
        $0 stop
+       sleep 2
        $0 start
        ;;
   *)
-       echo "Usage: $0 {start|stop|status|restart}"
+       msg_Usage "$0 {start|stop|status|restart|reload}"
        exit 1
        ;;
 esac
 
-exit 0
+exit $RETVAL
This page took 0.058721 seconds and 4 git commands to generate.