4 # description: Starts and stops the fetchmail daemon used to retrive mail \
5 # via various protocols (such as POP3 and IMAP4).
7 # config: /etc/fetchmailrc
10 # Source function library.
11 . /etc/rc.d/init.d/functions
13 # Source networking configuration.
14 # Get service config - may override defaults
15 [ -f /etc/sysconfig/fetchmail ] && . /etc/sysconfig/fetchmail
18 [ -z "$POLL_INTERVAL" ] && POLL_INTERVAL=300
21 [ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
23 # Check that networking is up.
24 if is_yes "${NETWORKING}"; then
25 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
26 msg_network_down "fetchmail"
33 # Check that fetchmailrc exists.
34 [ -f /etc/fetchmailrc ] || exit 0
37 if [ ! -f /var/lock/subsys/fetchmail ]; then
38 msg_starting "fetchmail"
40 is_yes $VERBOSE_LOGGING && OPTIONS="-v"
42 daemon fetchmail -d "$POLL_INTERVAL" $OPTIONS -f /etc/fetchmailrc
44 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
46 msg_already_running fetchmail
51 if [ -f /var/lock/subsys/fetchmail ]; then
52 msg_stopping "fetchmail"
54 rm -f /var/lock/subsys/fetchmail >/dev/null 2>&1
56 msg_not_running "fetchmail"
61 # See how we were called.
74 if [ -f /var/lock/subsys/fetchmail ]; then
75 msg_reloading "fetchmail"
76 killproc fetchmail -HUP
79 msg_not_running fetchmail
88 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"