Is there a script to compress mailboxes and touch new?
Pete Nesbitt
pete at linux1.ca
Sat May 29 03:36:09 UTC 2004
On May 28, 2004 12:08 am, Jake Johnson wrote:
> Hello,
> My Mail boxes are getting quite large and I was wondering if anyone had a
> script to append and gzip the files and touch new ones? --
> Jake Johnson
> http://www.plutoid.com
Jake,
Sounds like a fairly simple exercise if you just want to archive them without
worrying about access to recent mail. If you want to read into the files and
zip whats older than a certain date, that is a bit more work.
I beleive sendmail will just create any files needed so all you need to do is
stop sendmail and any pop/imap servers, then zip the dir and store it
somewhere (or each file), remove the existing files, restart the services.
As far as a script, you need to know what services might be accessing the
mailbox files. If it is only sendmail:
#!/bin/bash
MAIL_DIR="/var/spool/mail"
DATE=` date +%y-%m-%d`
/sbin/service sendmail stop
tar zcf /archives/mailboxes_$DATE $MAIL_DIR
rm -f $MAIL_DIR/*
/sbin/service sendmail start
# each critical step should be checked for success before moving on.
This is totally untested.
Hope that points you in the right direction.
--
Pete Nesbitt, rhce
More information about the redhat-list
mailing list