On Wednesday 19 Feb 2003 2:38 pm, Peter Watson wrote:
> My local mail gets put in /var/spool/mail/username. However I would like to
> read it in Kmail and so I have set up an incoming account which reads from
> /var/spool/mail/username, this is ok except that when I try to get mail I
> receive a message "could not lock /var/spool/mail/username".
>
> If I change the permissioms on /var/spool/mail/ to let others write entries
> everything works fine for a while until something (?msec) changes the
> permissions back to what they were.
>
> Can anyone tell me an elegant solution to this problem please?
If you were to read your mail spool at the same time as postfix was writing to
it, nasty things can happen. So to avoid this a lockfile is created before
Postfix starts writing, and will be deleted again when it is finished. Kmail
will not try to read the spool if the lockfile is present. Similarly Kmail
will create the lockfile before reading.
The default lockfile is /var/spool/mail/user_name.lock which your user does
not have write permission to hence your problem.
To fix it you could either configure your Kmail to not bother with the
lockfile (in the account settings), or else you could use procmail to define
a different lockfile.
If a ~/.procmailrc file exists postfix will pass mails over to procmail for
final delivery. An example ~/.procmailrc looks like this:-
SHELL=/bin/sh
PATH="$HOME/bin:/usr/bin:/usr/local/bin:/usr/include:/usr/local/sbin:/bin:/sbin:/usr/sbin"
MAILDIR=$HOME/Mail
LOCKFILE=/home/derek/.procmail/lockfile.lock
DEFAULT=/home/derek/Maildir
JUNKMAIL=/home/derek/junkmail
LOCKTIMEOUT=10
LOGFILE=~/procmail.log
LOGABSTRACT=all
VERBOSE=no
#Run SpamAssasin
:0fw
| spamassassin -a -P
:0e
{
EXITCODE=$?
}
:0: $LOCKFILE
* ^Subject:.*\*\*\*\*SPAM\*\*\*\*
$JUNKMAIL
# Catches everything else.
:0 : $LOCKFILE
$DEFAULT
In this configuration mails end up in ~/Maildir, and the lockfile is
~/lockfile.lock. This procmailrc also runs spamassassin to mark suspect
emails and put them into a mailfolder called JUNKMAIL
See man procmailrc
HTH
derek
--
----------------------------------
www.jennings.homelinux.net
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com