procmail
[Top] [All Lists]

Re: Procmail and umask

1998-01-09 08:35:51
On Thu, 8 Jan 1998 10:40:24 -0500, Vikas Agnihotri <VikasA(_at_)att(_dot_)com>
wrote:
Hello,
 Quoting a blurb from one of the other mailing lists I am on...regarding
how to detect which folders contain new mail
----------------------------------------------------------------------
There is a better way to find out which folders contain new mails if you
are using procmail to filter the mails.  (This was a hack by one of my
friends) procmail allows you to set UMASK on the folders. So before doing
anything, set UMASK to 076, which means the perms will be -rwx-----x to any
folder  which receives mails.  now using find -perm -001, you can print the
folders which have new mails.  the shell script which does this will also
have to chmod o-x on all these folders.
----------------------------------------------------------------------
How does this work? AFAIK umask only applies to new files created and not
to appending to existing files which is what procmail essentially does,
right? Or maybe my umask fundas are a little rusty?

Procmail does interpret UMASK this way, so this works, but I don't
think it's a particularly good solution. (It's actually hinted at in
the documentation for UMASK in procmailrc(5).) find is a rather heavy
program to start up every time you want to look for mail. (Haven't
done any timings, though.)
  I just grep -c '^From ' on my mail folders to see how many messages
there are in them. (This is only an approximation, in the case where
one or more messages contain unescaped From_ lines.)
  For a really pedestrian solution, keep all your spool files in their
own directory (I think this is a good idea for other reasons as well)
and do an ls -lrt on that directory, possibly piped into a sed script
to trim off files with timestamps older than, say, 24 hours. 
  If your mail reader will reset permissions on spool files when it
gets mail from them, the UMASK trick is a good base for a mail
checking script, but I would then only ls -l the spool files and look
for files with an x01 permission.

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