On Wed, 8 Oct 2003, Praedor Atrebates wrote:

> I had a ~/.fetchmailrc.  It worked so long as I started fetchmail
> myself.  If I tried to start fetchmail thus (as root)
> "/etc/init.d/fetchmail start" or if I started up MCC and then tried to
> start fetchmail from xservices I got the same result:  failure.  In my
> logs I would get a message that there was no mailserver specified.  I
> DID have a mailserver specified in my .fetchmailrc.  I then opened up
> webmin and saw my personal fetchmail entry there yet fetchmail service
> would not start for "lack" of a mailserver to poll.
> 
> Only after I copied my personal .fetchmailrc to /etc/fetchmailrc could I
> start fetchmail as a daemon in xservices and have it run properly at
> each startup. It didn't seem to care at all that I actually did have a
> valid ~/.fetchmailrc file and that it did contain a valid mailserver.  
> This is why I asked the original question about how to get
> /etc/fetchmailrc setup instead of ~/.fetchmailrc (the latter wasn't
> working).

You have confused fetchmail the CLI app with fetchmail the service (easy
enough to do, as they both use the same executable). I'll try to explain.

When you run fetchmail from the command line, it looks in the home dir of
the current user for a .fetchmailrc file to use; this is the case whether
it is run in daemon mode or in the default "fetch-once-and-end" mode. If
the $HOME/.fetchmailrc file does not exist or has incorrect permissions,
the program will fail to start. It always runs as the user that ran it.

When you run the fetchmail service, OTOH, it looks for an /etc/fetchmailrc
file to use, and will accept no substitutes (i.e., it will ignore any
~/.fetchmailrc files that may or may not exist). If the /etc/fetchmailrc
file does not exist or has incorrect permissions, the service will fail to
start. It runs as root. The only way to change the rc file it wants is to 
hack the initscript (as has been mentioned), and even then it will not run 
unless whichever rc file you specify is owned by root, with 600 perms.

Fetchmailconf can be used to craft a working ~/.fetchmailrc file, and that
file can be copied to /etc/fetchmailrc to be used by the service, but it
appears that fetchmailconf will not create or edit /etc/fetchmailrc in any
direct fashion (including running it as root, with ~/.fetchmailrc being a
symlink to /etc/fetchmailrc - won't work). That appears to be the length
and breadth of it, right there ... but copying the file into /etc after
making any changes to it is hardly what I'd call a big hardship, and you
could always write a one-line script (or even just an alias, perhaps?) to
run fetchmailconf and then do the copying/renaming of the file for you. ;)

HTH!

-- 
Bill Mullen   [EMAIL PROTECTED]   MA, USA   RLU #270075   MDK 8.1 & 9.0
The engineer is neither optimist nor pessimist. He sees the proverbial
half-full/empty glass and says, "The glass is twice as big as there is
any need for it to be."

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to