#! /bin/bash # # fetchmail Start/Stop the fetchmail service # Copyright (c) 2007 by Silvan Calarco # # chkconfig: 2345 90 60 # description: fetchmail is a command line pop3/imap client daemon # # Source function library. . /etc/init.d/functions RETVAL=0 FETCHMAIL_CONFIGFILE=/etc/fetchmailrc FETCHMAIL_PIDFILE=/var/run/fetchmail/fetchmail.pid prog="fetchmail" user="fetchmail" start() { echo -n $"Starting $prog: " ${prog} \ -m "/usr/sbin/sendmail -i -f %F -- %T" \ -L /var/log/fetchmail/fetchmail.log \ -f ${FETCHMAIL_CONFIGFILE} \ --pidfile ${FETCHMAIL_PIDFILE} evaluate_retval echo } stop() { echo -n $"Stopping $prog: " [ -e ${FETCHMAIL_PIDFILE} ] && { PID=`head -n1 ${FETCHMAIL_PIDFILE}` kill -9 $PID RETVAL=$? evaluate_retval rm -f ${FETCHMAIL_PIDFILE} echo } } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit $?