CRM Hosting


Add to Technorati Favorites

Scalix backup: Part 1- Users Message Store

If your server setup does not support creating file systems snapshots rsync-ing the message store is not the best solution because you may have to keep Scalix off for a long time. So you will need another way for saving data.


Based on scripts found on Scalix Community forums I created a small backup script which is more appropriate for my needs.
It will keep copies for every day of the week, so be sure you have enough free space on the backup volume.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
SCALIX_BIN=/opt/scalix/bin
LV_BIN=/usr/sbin
MOUNT=/bin/mount
DATEL=`date +%a`
BACKUP_DIR=/home/scalix_backup
MAILNODE=linsux,pc-tips
USERFILE=/tmp/userfile.$$
MKDIR=/bin/mkdir
DATE=`date`
LOG=/home/pctips/backup.log
function dump_users
{
 
$MKDIR -p $BACKUP_DIR/$DATEL
$SCALIX_BIN/omshowu -m $MAILNODE|cut -f1 -d'/' >$USERFILE
 
while read sc_username
do
        nospaces=`echo $sc_username|sed -e 's/[ \.]//g'`
        backup_file="$BACKUP_DIR/$DATEL/${nospaces}-mail.gz"
 
        echo `date +"%d-%m-%Y %l:%M:%S"` Starting backup for $sc_username >> $LOG
        $SCALIX_BIN/omcpoutu -n "$sc_username/$MAILNODE" -f - |gzip >$backup_file
        echo `date +"%d-%m-%Y %l:%M:%S"` Backup done for $sc_username  >> $LOG
done < $USERFILE
}
>$LOG
/bin/echo `date +"%d-%m-%Y %l:%M:%S"` >> $LOG
$SCALIX_BIN/omoff -d 0 rci imap
dump_users
 
$SCALIX_BIN/omon rci imap
/bin/echo `date +"%d-%m-%Y %l:%M:%S"` >> $LOG
cat $LOG | mail -s backup pctips@pc-tips.net


The script uses omcpoutu which copies a user message store into a file. During the backup users cannot access the server, so it’s better to run it when users usually don’t access the server. I set a cron job to run it at 1 AM. It takes about an hour to complete, for 11 users and 5 GB of gzip-ed data.


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button
Comments are DoFollow, so you may consider writing a small note :)

Leave a Reply



BRDTracker