Backing up Scalix

Discuss the Scalix Server software

Moderators: ScalixSupport, admin

Mouseclone
Posts: 209
Joined: Thu Nov 02, 2006 12:02 pm

Backing up Scalix

Postby Mouseclone » Wed Apr 11, 2007 3:05 pm

Is it possible to tar up the /var/opt/scalix directory?

I wrote a script to do so but I'm not sure that this would serve as a proper backup or not.

script:

Code: Select all


#!/bin/bash

###################################################
#                                                 #
#  This is a Scalix server backup script that     #
#  will mount a shared directory on Xavier and    #
#  tar the /var/opt/scalix directory to that      #
#  mount point.                                   #
#                                                 #
###################################################

# mount the shared directory of the server (this uses Samba because of the Window's FS)
mount -t cifs -o username=admin,password=password //xavier.domain.com/sysadmin /xavier/sysadmin

# Tar the /var/opt/scalix directory to the specified folder
tar -cvzf /xavier/sysadmin/Server\ Backups/scalix/scalix_`%s`.tar /var/opt/scalix/ >> /var/log/scalix_backup.log

#unmount the windows share
umount //xavier/sysadmin


One thing I have noticed is that when taring up the directory it removed the leading /. Is this ok? If when doing a restore the / is not put back then something is going to be broken.

I also did the LVM in FC5. I didn't plan a backup in the process. So I currently have no drive space left on the server. I will have to srink the size of the partition and then put the data back or use an alternitive to backing it up like Rsync or taring to the windows fileserver.

Any help would be greatful.

swordfish
Posts: 110
Joined: Mon Feb 05, 2007 6:27 pm

Postby swordfish » Wed Apr 11, 2007 4:05 pm

I think you have to make sure that all users are logged out and then pause/stop the Scalix server during the tar process and afterwards unpause/restart it. Probably you can unclude those commands in your backup script. However there is some backup scripts in the ARK already - http://www.scalix.com/wiki/index.php?ti ... source_Kit
Take a look at that as well.

Mouseclone
Posts: 209
Joined: Thu Nov 02, 2006 12:02 pm

Postby Mouseclone » Wed Apr 11, 2007 4:31 pm

Thanks for the response swordfish

I found what you were talking about and in manage_backup
contents:

Code: Select all

#!/bin/bash
# direcory where rsync is putting it's files

BACKUP_SOURCE_DIR=/home/sxbackup

# directory where full archives will be stored

BACKUP_DEST_DIR=/full_backups

# number of days to keep archives for (ex: 7 would keep archives for the last 7 days)

DAYS_TO_RETAIN=7

NUMBER_OF_CURRENT_BAKUPS=`ls ${BACKUP_DEST_DIR}|wc -l`

DATE=`date +%a`

#echo ${NUMBER_OF_CURRENT_BAKUPS}

if [ ${NUMBER_OF_CURRENT_BAKUPS} -gt ${DAYS_TO_RETAIN} ]
then
        let "NUMBER_TO_DELETE=${NUMBER_OF_CURRENT_BAKUPS} - ${DAYS_TO_RETAIN}"
        echo "Deleting ${NUMBER_TO_DELETE} files"
        for each_file in `ls -t ${BACKUP_DEST_DIR}| tail -${NUMBER_TO_DELETE}`
        do
                echo "deleting $each_file"
                rm -f ${BACKUP_DEST_DIR}/$each_file
        done
fi

tar zcf ${BACKUP_DEST_DIR}/sxbackup.$DATE.tgz ${BACKUP_SOURCE_DIR}


I could take the 7 day check and place it in front of what i have. Where the tar starts I would still need to keep what i have because I need to push it to our file storage server which is a Windows server. but that is neither hear nor there.

I also believe that the need to stop the services would help. that would at least give a full backup each night or when it is chose to run. I do think for getting a snapshot type file though out the day that you would keep the server up and running and just copy what you could down.

For a restore take the latest full and then the latest snapshot type tar and restore in that order.

Will this work? I'm not sure. I still question the hard links in the tar though. I really don't need to do a full restore of a server to find out that it is 3 times as large as it was. and have other issues.

Also what all services need to be stopped. In the past I have stopped: scalix scalix-tomcat scalix-postgres. Is there anything else that i'm missing to get a full backup of everything?

so far back up would look like

Code: Select all

#!/bin/bash
# direcory where rsync is putting it's files

BACKUP_SOURCE_DIR=/home/sxbackup

# directory where full archives will be stored

BACKUP_DEST_DIR=/full_backups

# number of days to keep archives for (ex: 7 would keep archives for the last 7 days)

DAYS_TO_RETAIN=7

NUMBER_OF_CURRENT_BAKUPS=`ls ${BACKUP_DEST_DIR}|wc -l`

DATE=`date +%a`

#echo ${NUMBER_OF_CURRENT_BAKUPS}

if [ ${NUMBER_OF_CURRENT_BAKUPS} -gt ${DAYS_TO_RETAIN} ]
then
        let "NUMBER_TO_DELETE=${NUMBER_OF_CURRENT_BAKUPS} - ${DAYS_TO_RETAIN}"
        echo "Deleting ${NUMBER_TO_DELETE} files"
        for each_file in `ls -t ${BACKUP_DEST_DIR}| tail -${NUMBER_TO_DELETE}`
        do
                echo "deleting $each_file"
                rm -f ${BACKUP_DEST_DIR}/$each_file
        done
fi

service scalix-tomcat stop
service scalix stop
service scalix-postgres stop

# mount the shared directory of the server (this uses Samba because of the Window's FS)
mount -t cifs -o username=admin,password=password //xavier.domain.com/sysadmin /xavier/sysadmin

# Tar the /var/opt/scalix directory to the specified folder
tar -cvzf /xavier/sysadmin/Server\ Backups/scalix/scalix_`%s`.tar /var/opt/scalix/ >> /var/log/scalix_backup.log

#unmount the windows share
umount //xavier/sysadmin

service scalix-postgres start
service scalix start
service scalix-tomcat start


If this seems incorrect to anyone please let me know. And as always thank you all for your help and knowledge.

swordfish
Posts: 110
Joined: Mon Feb 05, 2007 6:27 pm

Postby swordfish » Wed Apr 11, 2007 5:44 pm

Here is some recomendation from Subir in another topic about backup:

"Before creating backup of the message store on the old server do the following:
1. Shutdown Scalix using command omshut
2. Take backup of message store preserving permissions, as there are dependencies of
file permission using the command below:
Code:
cd /var/opt/
tar --preserve --same-owner -cvf /var/backup/scalixdata.tar scalix/*

the above command will restore the owner, permission and order."

Keep in mind that after omshut it might take up to 5 mins for the services to shutdown properly. So, may be put in your script waiting pariod after that command and check if the service exits cleanly. Then at the end after starting it, put a check again to see if all scalix service are running corerctly and email admin with the results.


Return to “Scalix Server”



Who is online

Users browsing this forum: No registered users and 0 guests

cron