On Thu, 2002-01-17 at 13:52, Jamie Wilkinson wrote:
> --[start snip]--
> #!/bin/sh
> 
> # Local delivery agent for Courier shared mailboxes from Postfix.
> # Delivers to $SHAREDIR/.$1/cur/, and ensures that the mail is g+rw
> # and owned by mail.$1
> # (c) 2002 Jamie Wilkinson, in the public domain.
> 
> # requires safecat and sudo to be installed
> 
> SHAREDIR=/home/shared/Maildir/> 
> if [ "$1" = "" ]; then 
>       exit 64  # /usr/include/sysexits.h
> fi
> 
> safecat $SHAREDIR/.$1/tmp/ $SHAREDIR/.$1/cur/
> # this'll take a short while...
> find $SHAREDIR/.$1/cur/ -type f -print0 | xargs -0 chmod 0660
> find $SHAREDIR/.$1/cur/ -type f -print0 | xargs -0 sudo chown mail.$1
> --[end snip]--
> 
> I'm not too happy about the duplicate find there, but it shouldn't take too
> long, due to the structure of the Maildir format it should only have to look
> in one directory.

Would it be worth giving the -perm argument to find?
find $SHAREDIR/.$1/cur/ -type f -perm 0600 -print0 | xargs -0 chmod 0660

That should limit the find results to the mail you've just delivered. 
Therefore you could probably also do something like:
RESULTS=`find $SHAREDIR/.$1/cur/ -type f -perm 0600 -print0`
echo $RESULTS | xargs -0 chmod 0660
echo $RESULTS | xargs -0 sudo chown mail.$1

Just a thought.  Completely untested, also probably wrong. :-)

-- 
Peter
[EMAIL PROTECTED]

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to