#!/bin/bash # # Simple fetchmail start/stop script that fits in with Red Hat's System V # system # These two lines allow the ntsysv stuff to work... # chkconfig: 345 87 13 # description: ESR's fetchmail program to check for new mail every few minutes. # processname: fetchmail # source function library . /etc/init.d/functions INTERVAL=500 # seconds RETVAL=0 start() { echo -n $"Starting fetchmail: " daemon fetchmail -d $INTERVAL --fetchmailrc /etc/fetchmailrc RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail } stop() { echo -n $"Shutting down fetchmail: " killproc fetchmail RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/fetchmail } case "$1" in start) start ;; stop) stop ;; restart|reload) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/fetchmail ]; then stop start RETVAL=$? fi ;; status) status fetchmail RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL