procmail
[Top] [All Lists]

Re: spool mail to 2 different mail directories

1997-02-13 19:13:26
At 03:51 PM 2/13/97 -0500, Pam Skillman wrote:
On Thu, 13 Feb 1997, James Beal wrote:

[snip]


1 0 * * * ( cd  /var/spool/mail/Backup ; rm -rf backup.4;mv backup.3
backup.4 ; mv backup.2 backup.3; mv backup..1 backup.2; mv today
backup.1; mkdir today ; chmod 1777 today  )  


thanks, I only have 2 more questions (yeah...so she says...:)

Hey, we've all been there... every one answer generates two new
questions :-)

Question #1:
Is there a synchronization problem between 'mv today backup.1' and
'mkdir today' where a message may be in the process of being delivered
to the spool in 'today' when you move it to backup.1???  

Question(s) #2:
Also, after the 'mv' and before the 'mkdir' completes??  If it were
attempting to deliver to a non-existent directory??...what would happen
there...would the message bounce??  or attempts to deliver before the
permissions are set correctly??

Thank you again!!



:0c
{
DROPPRIVS=yes
 
:0:
/usr/spool/mail/Backup/today/$LOGNAME/.
}


I think you can lock both of these; I'm only answering because I
haven't seen another answer, and I can't test this, so if someone
says I'm wrong, you should believe them I think!  :-)

Try (with whatever continuation chars are needed; I think word wrapping
has messed this up):

  1 0 * * * ( cd  /var/spool/mail/Backup ; lockfile ./Everything.lock ;
  rm -rf backup.4;mv backup.3
  backup.4 ; mv backup.2 backup.3; mv backup..1 backup.2; mv today
  backup.1; mkdir today ; chmod 1777 today ; rm -f ./Everything.lock  )  

and

  :0c: /var/spool/mail/Backup/Everything.lock
  {
  DROPPRIVS=yes
   
  :0:
  /usr/spool/mail/Backup/today/$LOGNAME/.
  }

Also, make sure your system boot procedure manages to remove the file
/var/spool/mail/Backup/Everything.lock whenever it exists.

HOWEVER... I think what I just suggested will also allow only one
filing to Backup at a time.  If your volume is high enough to make
that unacceptable, then maybe someone else can suggest something
better.

Cheers,
Stan


<Prev in Thread] Current Thread [Next in Thread>