Jump to content

Running fetchmail in daemon mode


Guest SDMF
 Share

Recommended Posts

I'm trying to set up fetchmail to automatically pull my e-mail into my local mailbox. To do this, it must be running in daemon mode. Since I have never manually configured any daemons, where should I put the command that would need to be called to start it in daemon mode every time I log in to linux?

Link to comment
Share on other sites

Guest BooYah

I set it in my /home/booyah/.fetchmailrc

set daemon 600

 

600 is 600 seconds.

 

I have it set up so sylpheed uses fetchmail to pull my mail from my POP, then sylpheed snags it from /var/mail/

 

hope this helps

Link to comment
Share on other sites

I have a different approach, I run it through cron as I'm only certain hours of the day online:

#Recogida automática de correo cada 10 minutos

*/10 0-8,18-23 * * mon-fri /usr/bin/fetchmail &> /dev/null

*/10 * * * sat,sun /usr/bin/fetchmail &> /dev/null

 

fetches the mail from dozens of accounts every ten minutes only when I want

 

HTH

Link to comment
Share on other sites

actually looking at my setup

 

i have it as a normal service in etc/rc.d/init.d/

with etc/fetchmailrc contains the polling options and account to user info

that way it is seen as a service in mcc which can be toggled to start at boot

Link to comment
Share on other sites

OK. Basically, I just want to use fetchmail to pull the mail down to my user account, so that I can read it with something like Pine, that can be used within a terminal session. This way I can look at my POP3 mail from other locations, if I were to SSH into my user account. I'm going to look at fetchmailrc, so I can see what the format is.

Link to comment
Share on other sites

OK, fetchmail only seems to work when I run it from the command line. I created a script in /etc/rc.d/init.d/ called fetchmail, here are the contents of that script:

# Launch fetchmail



/usr/local/bin/fetchmail -f /etc/fetchmailrc

 

This is my /etc/fetchmailrc

set postmaster "sdmf"

set bouncemail

set no spambounce

set properties ""

set daemon 600

poll mail.comcast.net with proto POP3

      user 'ej2980' there is 'sdmf' here

      pass 'hidden'

      fetchall

 

I looked in /var/spool/mail/, and there is nothing with my username in it.

 

I rebooted after adding the script to launch fetchmail. It's not showing as a running process when I run ps -e | grep fetchmail. The permissions on the script are 0744.

 

Also, johnnyv, there was no entry for it in the MCC after I rebooted it, which may have something to do with the fact that it is not running on boot.

Link to comment
Share on other sites

I just ran fetchmail --check, and it said that there were 2 messages waiting. But when I run fetchmail in daemon mode, it doesn't fetch anything.

Link to comment
Share on other sites

here is the contents of /etc/rc.d/init.d/fetchmail

 

#!/bin/sh

#

# chkconfig: 345 91 35

# description:	Starts and stops the fetchmail daemon used to retrive mail 

#  via various protocols (such as POP3 and IMAP4).

#

# config:	/etc/fetchmailrc



# Source function library.

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



# Source networking configuration.

. /etc/sysconfig/network



# Check that networking is up.

[ ${NETWORKING} = "no" ] && exit 0



# Check that fetchmailrc exists.

[ -s /etc/fetchmailrc ] || exit 0





RETVAL=0



# See how we were called.

case "$1" in

 start)

if [ ! -f /var/lock/subsys/fetchmail ]; then

 echo -n "Starting Fetchmail services: "

 daemon fetchmail -k -U -d 1200 -f /etc/fetchmailrc

 RETVAL=$?

 echo

 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail

else

 RETVAL=1

fi

      ;;

 stop)

if [ -f /var/lock/subsys/fetchmail ]; then

#  killproc fetchmail

 action "Shutting Fetchmail services: " /usr/bin/fetchmail --quit

 rm -f /var/lock/subsys/fetchmail >/dev/null 2>&1

 RETVAL=$?

else

 RETVAL=1

fi

      ;;

 restart)

$0 stop

$0 start

RETVAL=$?

;;

 reload)

if [ -f /var/lock/subsys/fetchmail ]; then

       echo -n "Reloading fetchmailrc file: "

 killproc fetchmail -HUP

 RETVAL=$?

 echo

else

 RETVAL=1

fi

;;

 status)

status fetchmail

RETVAL=$?

;;

 *)

echo "Usage: $0 {start|stop|restart|reload|status}"

exit 1

esac



exit $RETVAL

 

This is a mandrake script it was in mandrake 8.1 don't remember how i got it sorry

 

here is my /etc/fetchmailrc

set daemon 1200

poll pop.ihug.co.nz proto pop3

user "uroxsys5" pass "**********" is "john" here

user "uroxsys" pass "***********" is "shared" here

etc....

Link to comment
Share on other sites

ahhhhh you need to install the fetchmail-daemon rpm which puts the fetchmail script in the /etc/rc.d/init.d

 

and make it availiable as a service

 

edit: damn posting this stuff has pushed me into an "old timer" , seems abit of a let down after awesome :(

Link to comment
Share on other sites

ok, I just went to that site and created the mail file, and then tried to run the script that you posted. Here is the output:

[root@hangar18 etc]# /etc/rc.d/init.d/fetchmail start

Starting Fetchmail Services: execvp: No such file or directory

                                                               [FAILED]

Link to comment
Share on other sites

no. I'll have to get a newer version, though, than is included on the mandrake CD, since I compiled and installed version 6.2.1 of fetchmail from source.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...