rotate logs
#!/bin/sh
# snag information used for naming the log_file
THEMONTH=`date|awk '{print $2}'|tr '[A-Z]' '[a-z]'`
THEDAY=`date|awk '{print $3}'`
THEYEAR=`date|awk '{print $6}'`
#
# optional scripts to create sendmail reports
/usr/scripts/smlogstats.pl -d
/usr/scripts/smreject.pl -d
# move the log file
mv /var/log/maillog /var/log/maillog.$THEMONTH$THEDAY$THEYEAR
#
# saves a step
/usr/bin/killall -HUP syslogd
#
# check to make sure sendmail is still running -just incase
/usr/scripts/sendmail-restart.sh
#
# compress the file to save hard drive space
gzip /var/log/maillog.$THEMONTH$THEDAY$THEYEAR
#
Back to SALUG Main Page