procmail
[Top] [All Lists]

Re: /var/mail or $HOME/.mail

1997-10-06 08:01:14
On Mon, 6 Oct 1997 07:18:32 -0700 (PDT), wje(_at_)netcom(_dot_)com 
(William J. Evans; mail protected by spamgard{tm}) wrote:
era eriksson <era(_at_)iki(_dot_)fi> wrote:
:On Sun, 5 Oct 1997 21:35:38 -0400 (EDT),
:Douglas Semonche <semonche(_at_)nic(_dot_)com> wrote:
: > Also - how to move existing mail from /var/mail/$user to
: > $HOME/.mail - is there a tested script?
:The cron example in procmail(1) shows how to do locking. Other than
:that, you basically just mv the file.
... aaaaaand touch /var/mail/$user again, so nobody else can do so
with himself as owner.

Good point, thanks. In fact, better yet is to truncate the file
instead of recreate it, so as to keep whatever permissions it had
before (instead of write them up somewhere and remember to chmod the
new file to the same permissions later).

I.e.
    # Assuming $MAIL is set to /var/spool/$USER or /usr/spool/mail/$USER
    #  or what have you
    lockfile -ml
    # umask, anyone? I think cp will always keep the permissions
    cp $MAIL elsewhere
    >$MAIL
    lockfile -mu

Anything else we should remember?

/* era */

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

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