Harald Hanche-Olsen wrote:

> - 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

Why not chmod +t the home directory, then check, then chmod -t it to
defer mail delivery problems. Also, in the case of qpopper, you can touch
/var/spool/mail/.user.LCK (I believe that is the name) to temporarily
stop them from checking their POP mail. The odds of them checking in the
half second it takes to scan the mail box is unlikely so these
precautions are really just safety nets. If something wants to stop
working bad enough, it always does :)

--
Cris Daniluk                                   [EMAIL PROTECTED]
-------------------------------------------------------------
Digital Services Network, Inc.           http://www.dsnet.net
1129 Niles-Cortland Road, Warren, Ohio 44484  [EMAIL PROTECTED]
(330) 609-8624 ext. 20                     Fax (330) 609-9990
                 The Web Hosting Specialists
-------------------------------------------------------------


Reply via email to