[Mailman-Users] Using logrotate on /home/mailman/logs/*

Jon Carnes jonc at nc.rr.com
Sun Dec 2 02:34:14 CET 2001


On Saturday 01 December 2001 11:31, Nollaig MacKenzie wrote:
> Will I get in any trouble if I use
> logrotate on the files in /home/mailman/logs?
>
> TIA, N.

The FAQ is excellent in pointing out that each file must be specified 
directly in order for log-rotate to work properly. 

Personally I use the following script:
===
#!/bin/bash
# Script to rotate Mailman logs, this script should be run weekly - sometime
# when the list activity is low.
# It mails the top 100 lines of each log file and then rotates the log file
# to a file of the same name with .1 appended
# This can be extended to multipule weeks.
#     11-6-2001  Jon Carnes
#
echo "Mailman logs:"
echo "  [Salsa] /home/mailman/logs/..."
echo "  The logs should be checked weekly"
echo " "
#echo "============"
 
LOG_DIR="/home/mailman/logs"
MM_LOGS="qrunner error bounce smtp-failure vette \
       subscribe smtp post digest fromusenet"
 
ls -l $LOG_DIR |grep -v "\.1" |cut -c36-
for i in $MM_LOGS
do
  if [ -s $LOG_DIR/$i ]
  then
    echo " "
    echo " ====== " $i " ======"
    head -100 /home/mailman/logs/$i
    mv $LOG_DIR/$i $LOG_DIR/$i.1
    touch $LOG_DIR/$i
    chown mailman.mailman $LOG_DIR/$i
    chmod 0664 $LOG_DIR/*
  fi
done

===

The advantage is that it mails the logs to me weekly (just the top 100 
lines from each).  So I can kind of keep an eye on things.  It also keeps a 
backup of up to 2 weeks worth of log files.

I do wish that Mailman would install a file into /etc/cron.weekly to 
autorotate the files.

Jon 




More information about the Mailman-Users mailing list