#!/bin/sh
#
# description: The fetchmail daemon checks for mail over ppp
#
# Author[s]:
#	Andrea Sterbini	<a.sterbini@itelcad.it>

. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
    
# See how we were called.
case "$1" in
  start)
	echo -n "Loading fetchmail: "
	daemon /usr/bin/fetchmail -d 60 -f /etc/fetchmailrc
	echo
	touch /var/lock/subsys/fetchmail
	;;
  stop)	
	echo -n "Shutting down fetchmail: "
	/usr/bin/fetchmail -q >& /dev/null && echo fetchmail
#	killproc fetchmail
	rm -f /var/lock/subsys/fetchmail
	;;
  status)
        status fetchmail
        ;;
  restart|reload)
        $0 stop
        $0 start
        ;; 
	*)
	echo "Usage: fetchmail {start|stop|status|restart|reload}"
	exit 1
esac

exit 0

# === End of File ===
