#!/bin/sh # Beenden und Neustarten der Fetchmail-Daemons per init.d # . /etc/rc.config FETCH_BIN=/usr/bin/fetchmail FETCH_CONF=/etc/fetchmailrc FETCH_LOG=/var/log/fetchmail base=${0##*/} link=${base#*[SK][0-9][0-9]} test $link = $base && START_FETCH_DAEMON=yes test "$START_FETCH_DAEMON" = yes || exit 0 if [ ! -x $FETCH_BIN ] ; then echo -n "Fetchmail-Program nicht installiert ! " exit 5 fi . /etc/rc.status rc_reset case "$1" in start) echo -n "Starte FETCHMAIL als Daemon " checkproc $FETCH_BIN if [ $? -eq 0 ] ; then echo -n "- Warnung: FETCHMAIL laeuft bereits ! " rc_status -v && rc_exit fi startproc $FETCH_BIN -d 300 -f $FETCH_CONF -a -v -L $FETCH_LOG rc_status -v ;; stop) echo -n "Beende FETCHMAIL - Daemon ! " checkproc $FETCH_BIN || echo -n "- Warnung: FETCHMAIL laeuft nicht ! " killproc -TERM $FETCH_BIN rc_status -v ;; restart) $0 stop $0 start rc_status ;; status) echo -n "Pruefe auf: FETCHMAIL - Daemon ! " checkproc $FETCH_BIN rc_status -v ;; *) echo "Verwendung: $0 {start|stop|restart|status} " exit 1 ;; esac rc_exit #/usr/bin/fetchmail -q # Beenden des laufenden Fetchmail-Daemons # Starten von Fetchmail als Hintergrundprozess #/usr/bin/fetchmail -d 300 -a -f /etc/fetchmailrc # >> /var/log/fetchmail