Page 1 of 1

Archive then Delete...

Posted: Fri Jun 22, 2007 12:54 pm
by davidz
We want to setup Archiving on the server. So the plan we have come up with goes something like this:
We have archiving turned on with:

Code: Select all

ARCHIVE=bcc:archive@domian.com

Then the plan was to do sxboxexp on the mailbox once a month to an offsite storage location. So if something came up we could simply restore the email a month at a time to temporary mailboxes on the server.

My question is after I do the sxboxexp, I want to empty the archive mailbox so it only ever holds the current months email. After it exports, delete all of it and start fresh. I can't find an option in sxboxemp to remove exported email. So is there some other simple way to delete all the mail in a user's mailbox?

Thanks!
David

Posted: Fri Jun 22, 2007 12:59 pm
by dannyt
Hi,

Have a read of the man page for omtidyu, it may do what you want with the right options.

Regards,
Danny

Posted: Fri Jun 22, 2007 1:21 pm
by davidz
Thanks! Here is what I ended up using.

Code: Select all

omtidyu -B -u "Archive User" -Tiowfplr -S -a 0 -d -k -q

I will just run this after my smboxexp.

Thanks again,
David

Posted: Sat Jun 23, 2007 11:20 am
by KevinAnderson
If you really want to be complete, stop the Local Delivery service before you export the data, and leave it stopped until after you've emptied the mailbox. That way there's no fear that you might lose something between the processes running. I suspect this is happening afterhours, so pausing the LD service won't really impact anything.

Kev.

Posted: Mon Jun 25, 2007 9:58 am
by davidz
Something like this:

Code: Select all

omoff -d0 "Local Delivery"
omon "Local Delivery"


I also assume that by doing this the server will still receive mail just not deliver it to mailboxes?


Just for fun here is the simple script:

Code: Select all

#Output the Start Time
date
#Set the variables
#User to be Archived
USER_NAME=Archive
#Destination on var parition for space
DESTINATION_DIR=/var/tmp/ScalixArchive
#Filename (use June2006.gz format)
DATE=`date +"%B_%Y"`
FILENAME=$DATE.gz
#Full Destination
FINAL_LOCATION=$DESTINATION_DIR/$FILENAME

#Stop local delivery service so no mail gets missed
omoff -d0 "Local Delivery"

#This command Exports the mailbox and gzips it
sxmboxexp -u "$USER_NAME" -a - -F | gzip | cat > $FINAL_LOCATION

#This command Removes all the mail in the mailbox so there is only one month at a time
omtidyu -B -u "$USER_NAME" -Tiowfplr -S -a 0 -d -k -q

#Start local deliver again
omon "Local Delivery"

#Output the End Time
date


I have it run on the 1st day of every month at 12:01 AM.

Thanks for the Help,
David

Posted: Wed Jun 27, 2007 10:12 am
by jillrae
David,

thanks alot for posting your archive & delete script. I have one question. In the line of code:

DATE=`date +"%B_%Y"`

You use the charter ` What keyboard combination do you use to get this charter? I have run across this in other scripts and haven't found out out to create it.

Thanks

jillrae

Posted: Wed Jun 27, 2007 10:26 am
by davidz
jillrae wrote:You use the charter ` What keyboard combination do you use to get this charter? I have run across this in other scripts and haven't found out out to create it.


To the left of the number 1 key and above the tab key. A shift gets you a tilde ~ and no shift is the tick ` mark.

Posted: Wed Jun 27, 2007 11:02 am
by jillrae
Thank you. I can now "tick" with the best of 'em! :-)

jillrae