#!/bin/sh

# Preserve maximum of 4 copies of /var/log/cron.logrotate.log log.
# 
if [ -e /var/log/cron.logrotate.log.3 ]; then
    rm -f /var/log/cron.logrotate.log.3
fi
if [ -e /var/log/cron.logrotate.log.2 ]; then
    mv /var/log/cron.logrotate.log.2 /var/log/cron.logrotate.log.3
fi
if [ -e /var/log/cron.logrotate.log.1 ]; then
    mv /var/log/cron.logrotate.log.1 /var/log/cron.logrotate.log.2
fi
if [ -e /var/log/cron.logrotate.log ]; then
    mv /var/log/cron.logrotate.log /var/log/cron.logrotate.log.1
fi

echo `date` crond : scheduled logrotate activity > /var/log/cron.logrotate.log
/usr/sbin/logrotate -v /etc/logrotate.conf >> /var/log/cron.logrotate.log 2>&1
