On Thu, 18 Feb 1999, Rick McMillin wrote:

>list, it will automatically create all of files fine, but the permissions
>are wrong on all of the files.  Instead of being set to 644, they
>end up being set to 600.  The ownership on all of the files...
>Does anyone have any ideas?

mhonarc -umask 022

>Also, does anyone have any ideas as to how I can set this up
>to automatically create my "YYYY-MM" directories when the first
>message for the month gets posted to the list so I don't have to
>go in and create all of them by hand?

Here's the script I use in my .qmail file, it relies on procmail though to
do some logging and X-No-Archive honoring.  Its called "addtoindex" and
was originally written by a friend of mine, I just ported it to solaris
(where mktemp(1) doesn't natively exist and you can't trap sig 11) and
tweaked it slightly.  It creates YYYYMM directories but I'm sure you can
modify it to your needs.  I'd welcome any comments if somebody sees a
glaring error here.

#!/bin/sh

# usage: |preline addtoindex <listname>
FORMAIL=/usr/local/bin/formail
MHONARC=/usr/local/bin/mhonarc
MHONARCRC=/home/lists/etc/myspecial.mrc
LOGFILE=/home/lists/var/log/$1_mb.log
TMPDIR=/tmp/_addtoindex.$$
TMPFILE=$TMPDIR/formail-$1

mkdir $TMPDIR || {
  # possible DoS attack is occuring, log warning
  echo "WARNING: $TMPDIR exists, possible DoS, delaying delivery" >> $LOGFILE
  echo "Unable to deliver at this time (#4.3.0)"
  exit 111
}
# directory will be cleaned on exit or failure
trap 'rm -rf $TMPDIR' 0 1 2 3 4 5 6 7 8 9 10 12 13 14 15
cat | $FORMAIL > $TMPFILE
SUBJECT=`$FORMAIL -z -x Subject < $TMPFILE`
echo "${SENDER:-nobody} : ${SUBJECT:-none} : `date`" >> $LOGFILE
if ($FORMAIL -x X-No-Archive < $TMPFILE | grep -i yes); then
  echo "Not Archived - by user request" >> $LOGFILE
else
  OUTDIR=/web/lists/$1/`date +%Y%m`
  if [ ! -d $OUTDIR ]; then 
    mkdir -p -m 2775 $OUTDIR
  fi
  $MHONARC -add -time -locktries 360 -lockdelay 10 -umask 002 \
           -definevar LISTNAME="$1" \
           -rcfile $MHONARCRC -outdir $OUTDIR $TMPFILE >>$LOGFILE 2>&1
fi
exit 0


-- 
      [EMAIL PROTECTED]
 SALU.ne| Programmer/Analyst   917 SW Oak Street, Suite 405
        |                                Portland, OR 97205
        |                                (503) 242-0097 x20

Reply via email to