- Jay Soffian <[EMAIL PROTECTED]>:
| "Harald" == Harald Hanche-Olsen <[EMAIL PROTECTED]> writes:
|
| Harald> A simple shell script should do the job:
|
| #!/bin/sh
| find Maildir/new -type f -mtime +1 -print | while read m; do
| /var/qmail/bin/qmail-inject -a bill && mv $m Forwarded/new
| done
|
| There is a race condition here. Move the file before you run qmail
| inject on it. If the qmail inject fails, move it back.
Careful, or a crash at the wrong moment might cause a mail to be moved
but not forwarded. I think the race condition you are refering to is
more benign: It might cause a message to be forwarded more than once
(extremely unlikely), or a qmail-inject or mv to fail because the
message was yanked under the script's feet (more likely, since the
user may be reading his mail at the same time the cron job is
running). In fact, even moving the message first does not get rid of
this latter sort of race condition, since there is a time interval
between find discovering the file and the mv command running (or
between the user's MUA seeing the file and trying to move it). If the
MUA is not able to cope with the possibility of a message disappearing
like that, then the user must precede the reading of his mail by
first moving the messages using a more fault tolerant program. My
simple script could also need some work in that area. I never
intended it to be a complete solution, just a reasonable starting
point.
- Harald