LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   fetchmail daemon (https://www.linuxquestions.org/questions/linux-software-2/fetchmail-daemon-510139/)

ChrisScott 12-13-2006 02:55 PM

fetchmail daemon
 
Hi all,

I might be going about this all the wrong way. I added 'fetchmail -d 600' to the bottom of my /etc/profile file with the goal of having my mail automatically checked every ten minutes. This works fine. However, obviously if there is a second login on the same machine fetchmail moans (can't have daemon running twice). Is there a better way to get the fetchmail daemon to run on its own?

Maybe I could write a code to check if fetchmail -d is running and if not start it. I can't think how I'd go about this.

Any help would be much appreciated.

Chris

kotnik 12-13-2006 03:18 PM

Try adding this to your system startup script (rc.local, or something, depends on your distro):

fetchmail -f /path/to/your/.fetchmailrc

ChrisScott 12-24-2006 10:16 AM

Sorry it's taken me ages to reply!

That didn't seem to do anything. I did manage to write a script though and I'm quite satisfied with that.

Thanks for the help.

C

Nylex 12-24-2006 10:21 AM

Another thing you can do is have a cron job to run fetchmail every 10 minutes. This is mine for running it every 5 minutes:

*/5 * * * * /usr/bin/fetchmail >/dev/null 2>&1

This line just goes in your user's crontab. I had tried kotnik's suggestion myself, but this didn't work as it meant running fetchmail as root and I got an error/warning message saying not to do that.

kotnik 12-24-2006 07:39 PM

What about:

su username -c fetchmail

(Didn't try it, just a guess)

Nylex 12-25-2006 12:29 AM

Surely you couldn't do that in a startup script, as you'd need to enter your user's password?

kotnik 12-25-2006 11:29 PM

No, you don't need user's password, if you su-ing from root (as startup scripts are executed as root).


All times are GMT -5. The time now is 02:53 AM.