]> git.pld-linux.org Git - packages/fetchmail.git/blobdiff - fetchmail.init
- killed my previous bogus "fixes"
[packages/fetchmail.git] / fetchmail.init
index b319ae7bda7c66b9bee7e4f5e83d1656bed6e352..c3505e4f6a121a844cb5e25a8be8834b50ae0980 100644 (file)
 # Get service config - may override defaults
 [ -f /etc/sysconfig/fetchmail ] && . /etc/sysconfig/fetchmail
 
+# defaults
+[ -z "$POLL_INTERVAL" ] && POLL_INTERVAL=300
+
 # Get network config
 [ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
 
 # Check that networking is up.
-if is_no "${NETWORKING}"; then
-       msg_Network_Down "fetchmail"
-       exit 1
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network ]; then
+               msg_network_down "fetchmail"
+               exit 1
+       fi
+else
+       exit 0
 fi
 
 # Check that fetchmailrc exists.
@@ -31,42 +38,43 @@ case "$1" in
   start)
        if [ ! -f /var/lock/subsys/fetchmail ]; then
                msg_starting "fetchmail"
-               daemon fetchmail -f /etc/fetchmailrc
+
+               is_yes $VERBOSE_LOGGING && OPTIONS="-v"
+
+               daemon fetchmail -d "$POLL_INTERVAL" $OPTIONS -f /etc/fetchmailrc
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
        else
-               msg_Already_Running fetchmail
+               msg_already_running fetchmail
                exit 1
        fi
-        ;;
+       ;;
   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"
+               msg_not_running "fetchmail"
                exit 1
        fi      
-        ;;
+       ;;
   restart)
-        $0 stop
+       $0 stop
        $0 start
-        ;;
+       ;;
   reload)
        if [ -f /var/lock/subsys/fetchmail ]; then
                msg_reloading "fetchmail"
-               busy
                killproc fetchmail -HUP
-               deltext
-               ok              
+               RETVAL=$?
        else
-               msg_Not_Running fetchmail
+               msg_not_running fetchmail
                exit 1
        fi
        ;;
   force-reload)
-       # if program allows reloading without stopping
+       # if program allows reloading without stopping
        $0 reload
        exit $?
 
@@ -77,10 +85,10 @@ case "$1" in
   status)
        status fetchmail
        exit $?
-        ;;
+       ;;
   *)
-       msg_Usage "$0 {start|stop|status|restart|reload|force-reload}"
-        exit 1
+       msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+       exit 1
 esac
 
 exit $RETVAL
This page took 0.070385 seconds and 4 git commands to generate.