Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-31-2010, 04:43 AM
Loyal Member
 
Posts: 82
Default Zimbra backup - open source. Your commetns!!!

Zimbra backup - open source way
Every information technology system must be backed up frequently. Backup if performed correctly - should allow you for fast recovery after any disaster which might damage the entire system or for recovery of accidentally deleted or corrupted files. Unlike the Professional (commercial) version - open-source Zimbra is not equipped with any build in backup system. You need to take care of backing up your MTA by yourselve. Shell scripting and crontab prove to be useful once again.

#########################################
# Zimbra backup cut and paste howto
#########################################

mkdir /backup

mkdir /backup/zimbra

crontab -e

# Backup Zimbra Nightly
0 1 * * * /usr/local/bin/backup.sh


vim /usr/local/bin/backup.sh

#!/bin/bash

echo Time backup started = $(date +%T)
before="$(date +%s)"

rsync -avHK --delete /opt/zimbra/ /backup/zimbra

before2="$(date +%s)"

su - zimbra -c"/opt/zimbra/bin/zmcontrol stop"
sleep 15

kill -9 `ps -u zimbra -o "pid="`

rsync -avHK --delete /opt/zimbra/ /backup/zimbra

su - zimbra -c "/opt/zimbra/bin/zmcontrol start"

after="$(date +%s)"
elapsed="$(expr $after - $before2)"
hours=$(($elapsed / 3600))
elapsed=$(($elapsed - $hours * 3600))
minutes=$(($elapsed / 60))
seconds=$(($elapsed - $minutes * 60))
echo Server was down for: "$hours hours $minutes minutes $seconds seconds"

su - zimbra -c "zmcontrol -v > /backup/zimbra/conf/zimbra_version.txt"

echo Displaying Zimbra services status...
su - zimbra -c "/opt/zimbra/bin/zmcontrol status"

tar -zcvf /tmp/mail.backup.tgz -C /backup/zimbra .

echo Time backup finished = $(date +%T)

after="$(date +%s)"
elapsed="$(expr $after - $before)"
hours=$(($elapsed / 3600))
elapsed=$(($elapsed - $hours * 3600))
minutes=$(($elapsed / 60))
seconds=$(($elapsed - $minutes * 60))
echo Time taken: "$hours hours $minutes minutes $seconds seconds"

[root@mta002 ~]# less /usr/local/bin/backup.sh
[root@mta002 ~]# date
Mon Mar 29 09:57:26 EDT 2010
[root@mta002 ~]# date
Mon Mar 29 09:57:31 EDT 2010
[root@mta002 ~]# crontab -e
crontab: installing new crontab
[root@mta002 ~]# clear
[root@mta002 ~]# less /usr/local/bin/backup.sh
[root@mta002 ~]# cat /usr/local/bin/backup.sh

echo Time backup started = $(date +%T)
before="$(date +%s)"

rsync -avHK --delete /opt/zimbra/ /backup/zimbra

before2="$(date +%s)"

su - zimbra -c"/opt/zimbra/bin/zmcontrol stop"
sleep 15

kill -9 `ps -u zimbra -o "pid="`

rsync -avHK --delete /opt/zimbra/ /backup/zimbra

su - zimbra -c "/opt/zimbra/bin/zmcontrol start"

after="$(date +%s)"
elapsed="$(expr $after - $before2)"
hours=$(($elapsed / 3600))
elapsed=$(($elapsed - $hours * 3600))
minutes=$(($elapsed / 60))
seconds=$(($elapsed - $minutes * 60))
echo Server was down for: "$hours hours $minutes minutes $seconds seconds"

su - zimbra -c "zmcontrol -v > /backup/zimbra/conf/zimbra_version.txt"

echo Displaying Zimbra services status...
su - zimbra -c "/opt/zimbra/bin/zmcontrol status"

tar -zcvf /tmp/mail.backup.tgz -C /backup/zimbra .

#Copy to NAS or Windows share

#change 192.168.0.6 to the IP of your network device
#change yourname and yourpassword to the user that has
#permissions to use your network device

mount -t cifs //192.168.0.6/backup /mnt/bac001/ -o "username=yourname,password=yourpassword"
mount -t cifs //192.168.0.7/backup /mnt/bac002/ -o "username=yourusername,password=yourpassword"
cp /tmp/mail.backup.tgz /mnt/bac001/
cp /tmp/mail.backup.tgz /mnt/bac002/
umount /mnt/bac00*
#################################

I want to use above backup will it qualify the Standards of Backup techniques ?
Original Source of Zimbra Os backup
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.