[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
rotating logfiles
I've borrowed a little script to rotate logfiles, however this cause some
problems with zmailer.
Dec 8 00:07:25 office mailbox: Cannot open control file "local/15241" from
"/var/spool/postoffice/scheduler" as uid 0! (No such file or directory)
Dec 8 00:07:25 office mailbox: Cannot open control file "local/15241" from
"/var/spool/postoffice/scheduler" as uid 0! (No such file or directory)
here is the script I used:
-------------------------------------------------------------------------------
#
#
LOG=router
cd /usr/spool/log
test -f $LOG.2 && mv $LOG.2 $LOG.3
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
mv $LOG $LOG.0
cp /dev/null $LOG
chmod 644 $LOG
echo $LOG
#
LOGDIR=/usr/spool/log
LOG=scheduler
if test -d $LOGDIR
then
cd $LOGDIR
if test -s $LOG
then
test -f $LOG.2 && mv $LOG.2 $LOG.3
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
mv $LOG $LOG.0
cp /dev/null $LOG
chmod 666 $LOG
sleep 40
fi
echo $LOG
fi
##
LOGDIR=/usr/spool/log
LOG=smtp
if test -d $LOGDIR
then
cd $LOGDIR
if test -s $LOG
then
test -f $LOG.2 && mv $LOG.2 $LOG.3
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
mv $LOG $LOG.0
cp /dev/null $LOG
chmod 666 $LOG
sleep 40
fi
echo $LOG
fi
#
if [ -r /etc/zmailer.conf ]; then
. /etc/zmailer.conf
if [ ${MAILSERVER-NONE} = NONE -a -x $MAILBIN/zmailer ]; then
echo
$MAILBIN/zmailer bootclean
echo
$MAILBIN/zmailer & echo ' zmailer restarted.'
fi
fi
-----------------------------------------------------------------------------
Is this the best way to do it?
Ideally I want to rotate logs via cron anyone else done this with success?
Regards,
Neil
--
Neil J. McRae Demon Internet
neil@demon.net