View Single Post
  #2 (permalink)  
Old 02-11-2010, 04:44 AM
dudi dudi is offline
New Member
 
Posts: 3
Default Bash Scripting Live Backup for FOSS Edition

i've made a bash script to do a live backup.

this script is similar with script has been made by dhipo.

rsync and ssh not including in this script, but I think we can modifying and merging this script with other scripts from the wiki page.

the goal is to do a remotely synchronization using rsync, ssh and "live" backup for zimbra open source edition.

Code:
#!/bin/bash
### START CONFIGURATION ###
DIR="/tmp/zimbra";
OUTPUT="/tmp/zimbra";
### END OF CONFIGURATION ###

USERS=`su - zimbra -c 'zmprov gaa'`;
DATE=`date +%Y%m%d`;

if [ ! -d $DIR ]; then mkdir $DIR; chown zimbra:zimbra $DIR; fi

for ACCOUNT in $USERS; do
        NAME=`echo $ACCOUNT | awk -F@ '{print $1}'`;
        su - zimbra -c "zmmailbox -z -m $ACCOUNT getRestURL '//?fmt=tgz' > $DIR/$NAME.tgz";
done
cd $DIR; mkdir $DATE; mv *.tgz $DATE
tar cjpf $OUTPUT/$DATE.tar.bz2 $DATE;
cd $DIR; rm -rf $DATE
Reply With Quote