SoloCDM asked,
| Why is the following message from the backup cache recipe occasionally
| displayed in procmail's log with a different file each time?
|
| ls: msg.koRB: No such file or directory
It sounds like a race condition. Two procmails are trying to run the backup
recipe at almost exactly the same time, and between the time the second one's
shell expands msg.* and the time its ls call tries to list the backups from
newest to oldest, the first procmail process has deleted the very oldest of
them.
You might want to use a regional lockfile to prevent that, so that only one
procmail process can trim the backup cache at a time:
LOCKFILE=backup/.lock
:0c
backup
:0aciW
| cd backup && rm -f dummy `ls -t msg.* | sed 1,32d`
LOCKFILE
or you might want procmail to skip the deletion if one is already in progress:
:0c
backup
:0aci
* ? lockfile -r0 backup/.lock # If at first you don't succeed, screw it.
| cd backup && rm -f `ls -t msg.* | sed 1,32d` .lock
If there's a way to do the latter with procmail's internal locking instead of
using the lockfile executable, will someone please post it?