]> git.pld-linux.org Git - packages/fetchmail.git/blobdiff - fetchmail.init
- obsolete
[packages/fetchmail.git] / fetchmail.init
index 57d7bb7b58bc3315fb702f855e65ec545325748d..9992a679d8b9fae7019c1c0bec5c7a538c19a7bc 100644 (file)
@@ -22,7 +22,7 @@
 
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
-       if [ ! -f /var/lock/subsys/network ]; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
                msg_network_down "fetchmail"
                exit 1
        fi
@@ -33,9 +33,7 @@ fi
 # Check that fetchmailrc exists.
 [ -f /etc/fetchmailrc ] || exit 0
 
-# See how we were called.
-case "$1" in
-  start)
+start() {
        if [ ! -f /var/lock/subsys/fetchmail ]; then
                msg_starting "fetchmail"
 
@@ -46,51 +44,49 @@ case "$1" in
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
        else
                msg_already_running fetchmail
-               exit 1
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/fetchmail ]; then
                msg_stopping "fetchmail"
                killproc fetchmail
                rm -f /var/lock/subsys/fetchmail >/dev/null 2>&1
        else
                msg_not_running "fetchmail"
-               exit 1
-       fi      
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   restart)
-       $0 stop
-       $0 start
+       stop
+       start
        ;;
-  reload)
+  reload|force-reload)
        if [ -f /var/lock/subsys/fetchmail ]; then
                msg_reloading "fetchmail"
-               busy
                killproc fetchmail -HUP
                RETVAL=$?
-               [ $RETVAL -eq 0 ] && ok || died
        else
                msg_not_running fetchmail
-               exit 1
+               exit 7
        fi
        ;;
-  force-reload)
-       # if program allows reloading without stopping
-       $0 reload
-       exit $?
-
-       # or if it doesn't
-       $0 stop && $0 start
-       exit $?
-       ;;
   status)
        status fetchmail
        exit $?
        ;;
   *)
        msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
-       exit 1
+       exit 3
 esac
 
 exit $RETVAL
This page took 0.544823 seconds and 4 git commands to generate.