compress/tar archive mail dirs

Christo Bezuidenhout christo at IT4AFRICA.CO.ZA
Fri Nov 21 15:09:24 GMT 2003


I have the following two scripts Running. Firstly I create a file with
today's date in it.

echo `date +%Y%m%d` > /mailback/date

Then the following script run the next day 00:03 just to make sure all
mail for the previous day is in the folder. It create a tar.gz file in a
separate folder with the date for that archive and delete the old files.

mkdir /mailback
cd /mailback
for i in $(cat /mailback/date); do
mkdir $i
cd $i
tar --remove-files -cvf backup.tar /var/spool/MailScanner/archive/$i/
mv backup.tar /mailback/Mail-$i.tar
cd /mailback
gzip Mail-$i.tar
rm $i -rf
done

Hope this help.


-----Original Message-----
From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK] On
Behalf Of Martin Hepworth
Sent: Friday, November 21, 2003 4:23 PM
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.

**********************************************************************

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Mailscanner thanks IT For Africa for their support.



More information about the MailScanner mailing list