Dear list,
since error "451 ... end status 256" happen to me this week and couple weeks ago. I create this little script to backup qmail log, so if I am out of office and users complaining error about mailserver I can trace what happen back w/o have to worry losing qmail log (of course the script should be ran daily)
hope this little script could be usefull also for you
note to Jake: I dont use tai64nlocal

Script name backupqmaillog.sh
--------------------------------------------------------
#!/bin/bash
#
# qmaillog backup utility
# version 0.1
# [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
# 4 Aug 2007
# this qmaillog backup utility by default will backup
# today qmail's send and smtp log into /home/backuplog
# and keep it for the next 7 days
# enhancement are always welcome


# where your qmail log folder
# QMAILLOG=/var/log/qmail
QMAILLOG=/var/log/qmail
# what log is going to backup ?
# by default only smtp and send log only
# possible log to backup are:
# LOGS="authlib clamd imap4 imap4-ssl pop3 pop3-ssl send smtp spamd submission"
LOGS="send smtp"
# your backup destination
# folder will be created automatically
# BACKUP_DEST=/home/backuplog
BACKUP_DEST=/home/backuplog
# how long you will save the backup
# BACKUP_AGE=7 # days
BACKUP_AGE=7 # days

# ============================
# process
# ============================
DATE=`date +%Y%m%d`
TMPFILE=/tmp/backuplist
DAILY_AGE=1 # day
DAILY_AGE_MINS=$[ $DAILY_AGE * 60 * 24 ]
BACKUP_AGE_MINS=$[ $BACKUP_AGE * 60 * 24 ]

for i in $LOGS;
do
mkdir -p $BACKUP_DEST/$i
find $QMAILLOG/$i/* -cmin -$DAILY_AGE_MINS -exec ls -1 {} \; > $TMPFILE
tar czf $BACKUP_DEST/$i/$i-$DATE.tar.gz -T $TMPFILE
rm -f $TMPFILE
find $BACKUP_DEST/$i/*.tar.gz -cmin +$BACKUP_AGE_MINS -exec rm -f {} \;
done

---------------------------------------------------------------------
    QmailToaster hosted by: VR Hosted <http://www.vr.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to