> I would like those mails to be processed again by procmail to be
> put in the adequate folders...
>
> I scanned procmail's manpage for an answer and found this nice
> little script that should do exactly what I need :
> #!/bin/sh
>
> ORGMAIL=/usr/spool/mail/$LOGNAME
>
> if cd $HOME &&
> test -s $ORGMAIL &&
> lockfile -r0 -l3600 .newmail.lock 2>/dev/null
> then
> trap "rm -f .newmail.lock" 1 2 3 15
> umask 077
> lockfile -l3600 -ml
> cat $ORGMAIL >>.newmail &&
> cat /dev/null >$ORGMAIL
> lockfile -mu
> formail -s procmail <.newmail &&
> rm -f .newmail
> rm -f .newmail.lock
> fi
> exit 0
>
> But the problem is : lockfile -ml try to lock my system mailbox with
> /usr/spool/mail/gilles.lock and there is NO such directory on my system
(my
> system mailbox is under /var/mail).
Lockfile is part of procmail; if it thinks that your mail drop is
/usr/spool/mail when it is really at /var/mail/$LOGNAME, then it is
configured incorrectly, and most likely procmail as well.
Before procmail is installed, it needs to be properly configured, and
this process is mostly automatic.
You should point this out to your sysadmin and demonstrate that lockfile
will fail to work as advertised, possibly resulting in loss of mail due
to its malfunction.
If you sysadmin is uncooperative, you can configure and install lockfile
locally in your own directory (ie: $HOME/bin) and it will work just
fine.
> So what can I do ? (apart from asking sweetly to my system
> administrator to put system mailboxes in /usr/spool/mail)
> Is a "normal lock" the right workaround ? (I do not know whether the
> locking should be different for mailboxes)
To workaround solutions:
a. place a symbolic link from /usr/spool/mail -> /var/mail (which I
recommend anyway to make BSD-based mail programs happy).
b. use an explicit filename on the lockfile command:
lockfile /var/mail/$LOGNAME.lock
# ...protected process
rm -f /var/mail/$LOGNAME.lock
G'luck.
___________________________________________________________
Alan Stebbens <aks(_at_)sgi(_dot_)com> http://reality.sgi.com/aks