On Wed, Jan 14, 2009 at 11:30 AM, Stephen Irons <[email protected]> wrote: > I am busy setting up an automatic mail retrieval system at home. It will > collect email from a number of different remote POP mailboxes and deliver it > to the appropriate local users. > > getmail seems to fit the bill, and I have a system up and running to do just > that -- it collects email and puts it into the appropriate > /var/spool/mail/$USER mbox file. > > Now, getmail allows for two different types of file locking for the > /var/spool/mail/$USER file: flock and lockf. flock uses a lock file, while > lockf uses fcntl locking, which I gather is some internal kernel feature. > > Also, the getmail manual [1] warns that other programs using the mbox file > must use the same type of locking, to prevent them from accessing the file > simultaneously and causing corruption. It encourages you to ask the system > administrator what type of file locking the system uses. > > I AM the system administrator and I don't know what type of file locking it > uses. I have not been able to discover the answer with a number of Google > searches. > > > Can anyone suggest a search string, or just tell me what type of mbox file > locking Ubuntu Intrepid uses for mbox files in /var/spool/mail? > > > An alternative suggested by getmail is to deliver mail to Maildirs instead > of mboxes. However, neither Evolution or Thunderbird can retrieve mail from > Maildirs into their own internal format, although Evolution can access a > Maildir store. So I would prefer that getmail delivered to the > /var/spool/mail mboxes. > > A third alternative is just to hope that the mail client, getmail and any > other mail generators (I know that anacron occasionally sends email to the > system administrator) never access the mbox simultaneously, and if they do, > that Someone Else has already thought about the problem and that the getmail > default (lockf) is correct. > > Stephen Irons >
My approach (which doesn't answer your question, but avoids locking issues) is to: 1. deliver to maildirs (I use fetchmail, but your choice is valid too) 2. install a imap server that also access maildir (dovecot is good) 3. get your clients to access the imap store (all support imap). This way you get a central mail store that is accessible from any computer in any client and which gives a consistent view - ie you haven't got some mail in thunderbird on machine X, some in Evolution on machine Y etc. It is also easy to add a webmail service. Its also easier to back up your mail (its all stored on one machine). mbox gets very slow if you store a lot of mail in it. Its basically one big file that represents the whole folder. maildir is superior in many ways! I have run my own small (but with large folders, I am a hoarder) email server for many years and the above approach grew out of frustrations at previous iterations.
