procmail
[Top] [All Lists]

Re: safe writing to spool

2003-01-20 14:24:06
Kevin Rice <krice(_at_)spss(_dot_)com> wrote:

Is there any safe way to write to a users' mbox file? The reason I
ask is that the box I've got set up has been modified such that even
messages that are intended to be locally delivered are forwarded by
sendmail to non-local addresses.

I'm sure there is.  Someone mentioned safecat here awhile back.  I had
never heard of it before.  It may be specific to Maildir.  Methods may
vary from system to system.  On mine, this one happens to work for me:

  % cat mcat
  #!/bin/sh -e
  # Moves one mail file to the end of another, protected by lockfile.

  cd "${MAILDIR-$HOME/Mail}"

  frm -Q "$1" || exit 0

  lockfile -r3  "$1".lock "$2".lock &&
  cat   "$1" >> "$2"                &&
  rm -f "$1"    "$1".lock "$2".lock

  # Ver. 1.0;  9/16/02; by Mike Peeler <zconcept(_at_)netcom(_dot_)com>

Mike


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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