HowTos/BackupScript Mbox Style
From Scalix Wiki
This is a shell script I use to backup all my users to a single flat file (mbox style). I then backup the directory to an offisite location for disaster recovery purposes.
This script backs up all user mailboxes into a single flat file (mbox style) in the directory specified (MBOXDIR). I backup those .mbox files to an offsite archive for disaster recovery purposes. Every time you run this script it will look in the directory specified for an existing .mbox file. If it finds one it will delete it first, then create a new .mbox file from the Scalix Server. This was written for Scalix Server v11. I do know know how well it will work with earlier versions.
Script
#! /bin/bash echo "Mailbox Backup Starting [`date`]" MBOXDIR="/backup/mailboxes" if [ -d $MBOXDIR ]; then echo "Found Backup Directory. Using It." else echo "Creating Backup Directory ${MBOXDIR} to backup mailboxes." mkdir ${MBOXDIR} fi for i in $(omshowu -m all | cut -d "/" -f 1 | sed -e 's: $::g' -e 's/ /\//g'); do user=`printf "$i" | sed -e 's:/: :g'` # # $user = Username With Space # $i = Username With \ Before Space # ex: $user="Firstname Lastname" # ex: $i="Firstname\ Lastname" # echo ${user} if [ -a $MBOXDIR/$i.mbox ]; then echo "Existing backup found. Removing before creating new backup." rm ${MBOXDIR}/${user}.mbox fi echo "Backing up user ${user}" sxmboxexp -u "${user}" -a ${MBOXDIR}/"${user}".mbox --listlevel folder -F done