HomeBanner

Servers: Mail and Spam

Fetchmail FAQ

1. How can I enable fetchmail as a deamon to start at boot time ?
2. How can I make fetchmail to deliver via procmail ?
1.

How can I enable fetchmail as a deamon to start at boot time ?

A sample script is placed at /usr/share/doc/packages/fetchmail/README.SuSE

If you want to fetch mail periodically, you can start fetchmail as a daemon using the following init script:


#! /bin/sh
# Copyright (c) 1996-2000 SuSE GmbH Nuremberg, Germany.  All rights reserved.
#
# Authors: Klaus Franken
#          Björn Jacke
#
# /etc/init.d/fetchmail
#
# please edit /etc/fetchmailrc
#
### BEGIN INIT INFO
# Provides:		fetchmail
# Required-Start:	network
# Required-Stop:
# Default-Start:	2 3 5
# Default-Stop:
# Description:		run fetchmail in daemon mode
### END INIT INFO

. /etc/rc.config
return=$rc_done

case "$1" in
    start)
        echo -n "Starting fetchmail-daemon"
        /usr/bin/fetchmail -d 900 -a -f /root/.fetchmailrc -L /var/log/fetchmail 2>&1 || return=$rc_failed
        echo -e "$return"
        ;;
    stop)
        echo -n "Shutting down fetchmail-daemon"
        /usr/bin/fetchmail -quit || return=$rc_failed
        echo -e "$return"
        ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
esac

exit 0

	

The file to which the -f option points must be the .fetchmailrc of the user who has to fetch the mail. Put the script in /etc/init.d/ and make it executable:

cd /etc/init.d/
chmod +x fetchmail
	  

and finally run insserv.

2.

How can I make fetchmail to deliver via procmail ?

You need to add:

mda "/usr/bin/procmail  -d  %T"
      

to your "options" in ~/.fetchmailrc For instance .fetchmailrc may look something like:

poll mail.domain.com protocol pop3
username myusername
password mysecretpassword
 options ssl mda "/usr/bin/procmail  -d  %T"
      


Updated: Tue, 03 Feb 2004
Valid CSS!Valid HTML 4.01!