]> git.pld-linux.org Git - packages/inn.git/blobdiff - inn.init
- rel 2
[packages/inn.git] / inn.init
index 84ce07561c11c4a8af55ad249c4e18811ba53696..ccb7910060fabd229eb842d2ab8f211d38e6b2f8 100644 (file)
--- a/inn.init
+++ b/inn.init
@@ -26,45 +26,33 @@ if is_yes "${NETWORKING}"; then
 else
        exit 0
 fi
-                       
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+
+start() {
        if [ ! -f /var/lock/subsys/inn ]; then
                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"
-                       su news -c ovdb_init 2>&1 > /dev/null
-                       ok
+                       daemon --pidfile /var/run/news/ovdb_monitor.pid --user news ovdb_init
                fi
 
                msg_starting "INN"
-               daemon su news -c inndstart
+               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
-                       su news -c "umask 002
-                       /usr/bin/setsid /usr/bin/innwatch &" </dev/null >&0 2>&0
+                       daemon --fork --pidfile /var/run/news/innwatch.pid --user news /usr/bin/innwatch
                        RETVAL=$?
-                       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/inn
-                       ps -C innwatch >/dev/null 2>&1 || usleep 500000
-                       if [ $RETVAL -eq 0 ] && ps -C innwatch >/dev/null 2>&1; then
-                               ok
-                               touch /var/lock/subsys/inn
-                       else
-                               RETVAL=1
-                               fail
-                       fi
-               else
-                       touch /var/lock/subsys/inn
+                       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/innwatch
                fi
        else
                msg_already_running "INN"
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/inn ]; then
                msg_stopping "INN"
                busy
@@ -76,31 +64,27 @@ case "$1" in
 
                if [ -f /var/run/news/innwatch.pid ]; then
                        msg_stopping "INN Watch"
-                       busy
-                       if killall -9 innwatch; then
-                               ok
-                       else
-                               died
-                       fi
+                       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/infeed.pid ]; then
                        msg_stopping "INN Feed"
-                       killproc innfeed -9
+                       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 actived -9
+                       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 ovdb_monitor -15
+                       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
@@ -108,10 +92,23 @@ case "$1" in
        else
                msg_not_running INN
        fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   status)
+       status innwatch
        status innd
-       exit $?
+       if [ $? -eq 0 ]; then
+               innstat
+       fi
        ;;
   reload|force-reload)
        if [ -f /var/lock/subsys/inn ]; then
@@ -126,9 +123,9 @@ case "$1" in
        fi
        ;;
   restart)
-       $0 stop
+       stop
        sleep 2
-       $0 start
+       start
        ;;
   *)
        msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
This page took 0.436604 seconds and 4 git commands to generate.