running procmail on the contents of /var/mail/$USER

Peter L. Peres plp-ysDPMY98cNQDDBjDh4tngg at
Thu Jul 29 05:26:24 UTC 2004

> Anyway, I don't see anything wrong with William's syntax.  There's no
> requirement to specify an rc file with procmail, if you don't it will just
> use your ~/.procmailrc.  In other words, William's syntax was equivalent to:
>    formail -ds procmail ~/.procmailrc < /var/mail/$USER

You CAN'T run that command, ever. procmail detects that someone else (bash 
through <) reads /var/mail/$USER and refuses to run as it should, waiting 
for bash to give up, i.e. forever. This will work (beware not tested as 
written !):

 	cp /var/mail/$USER ~/tmp/mbox
 	/etc/init.d/mta stop
 	rm -f $MBOX; touch $MBOX; chown $USER mail $MBOX; chmod 660 $MBOX
 	/etc/init.d/mta start
 	formail +1 -ds procmail ~/.procmailrc <~/tmp/mbox

I used a very similar concept to recover mail from (ancient) archives. If 
your procmail recipe is set up right, then it will work.

The Toronto Linux Users Group.      Meetings:
TLUG requests: Linux topics, No HTML, wrap text below 80 columns

More information about the Legacy mailing list