compress/tar archive mail dirs

Jason Burzenski jburzenski at AMERICANHM.COM
Fri Nov 21 15:35:22 GMT 2003


I use a script to grab all quarantine dirs older than 5 days, compress them
and then send them off to an ftp site.  Uses ncftpput for the transfer.
Could use some cleaning up....

#!/bin/bash
# /root/scripts/samsback.sh
# JVB - 09102003
# Quarantine Folder Backup Script
#
# configure vars and add to crontab

QDIR=/var/spool/MailScanner/quarantine
OLDERTHAN=5 # days
SCRIPTDIR=/root/scripts
HOST=hostname (or $(hostname)
FTPHOST=ipofftpserver
FTPUSER=ftpuser
FTPPASS=ftppass
FTPRMTDIR=/ftp/remote/dir

#
#
#
#
#

if [ ! -z $1 ];then
        SRC=$(echo $1 |cut -d/ -f6)
        if (tar czf $QDIR/$HOST.$SRC.tar.gz $QDIR/$SRC); then
                rm -rf $QDIR/$SRC
                ncftpput -V -DD -u $FTPUSER -p $FTPPASS $FTPHOST $FTPRMTDIR
$QDIR/$HOST.$SRC.tar.gz
        else
                echo $QDIR/$SRC failed to compress...
        fi
else
        find $QDIR -mtime +$OLDERTHAN -maxdepth 1 -type d -exec
$SCRIPTDIR/samsback.sh {} \;
fi




> -----Original Message-----
> From: Martin Hepworth [mailto:martinh at SOLID-STATE-LOGIC.COM]
> Sent: Friday, November 21, 2003 9:23 AM
> To: MAILSCANNER at JISCMAIL.AC.UK
> Subject: compress/tar archive mail dirs
>
>
> Hi all
>
> anyone got a handy script that will find previous days
> archive email dirs and compress/tar them up and delete the
> directory afterwards?
>
> Could write something myself, but not wanting to re-invent
> the wheel...
>
> alternatively could this be an option in the Archive Mail
> config so when it rolls over to the next dir, it tgz-ed (or
> whatever) yesterdays archive directory??
>
> --
> Martin Hepworth
> Snr Systems Administrator
> Solid State Logic
> Tel: +44 (0)1865 842300
>
>
> **********************************************************************
>
> This email and any files transmitted with it are confidential
> and intended solely for the use of the individual or entity
> to whom they are addressed. If you have received this email
> in error please notify the system manager.
>
> This footnote confirms that this email message has been swept
> for the presence of computer viruses and is believed to be clean.
>
> **********************************************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mailscanner.info/pipermail/mailscanner/attachments/20031121/afbb5301/attachment.html


More information about the MailScanner mailing list