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 10-20-2010, 12:19 PM
Senior Member
 
Posts: 51
Default Simple backup script

I was looking to make a very simple (yet effective) backup script for Zimbra CS.
I know there are a lot of versions here in the forum but they seem not to generate easily recover backups. So I made this

Code:
#!/bin/bash
#this is where I will store the backup files outside the server
mount //131.107.2.151/PUBLIC /media/mybookworld -o username=root,password=somepass
/etc/init.d/zimbra stop
# this is for freeing cache
echo 3 > /proc/sys/vm/drop_caches
# now I make a directory called after the date
mkdir /home/administrador/zimbra/`date +%Y%m%d`
# and I use rsync to create an exact copy
rsync -avHK /opt/zimbra/ /home/administrador/zimbra/`date +%Y%m%d`
# I start again all services
/etc/init.d/zimbra start
cd /home/administrador/zimbra/
# now I free some disk space deleting the oldest backup directory
ls | head -1 | xargs rm -r
# make a tarball
tar -cf /home/administrador/zimbra/`date +%Y%m%d`.tar /home/administrador/`date +%Y%m%d`
# compress it
gzip `date +%Y%m%d`.tar
# split it and save it in a network disk
split -d -b4400m /home/administrador/zimbra/`date +%Y%m%d`.tar.gz /media/mybookworld/zimbra/`date +%Y%m%d`.tar.gz.
# now I create a file with the md5 checksum of each archive for later reference
find /home/administrador/zimbra/`date +%Y%m%d`.tar.gz.* -type f -print0 | xargs -0 md5sum > /media/mybookworld/zimbra/`date +%Y%m%d`.md5
This is executed at late night hours when server is almost idle.

The question is: in case of failure would the copy of /opt/zimbra made this way be enough to restore the server?

This might be a silly question but I was not able (and I hope I won't have ) to test it in a real situation.

Thanks,

Pancho
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.