Results 1 to 1 of 1

Thread: ZCS OSE hot backup via REST

  1. #1
    Join Date
    Oct 2009
    Location
    Switzerland
    Posts
    3
    Rep Power
    6

    Default ZCS OSE hot backup via REST

    Hello,

    in addition to a cold backup, I'm trying to implement a hot backup for individual accounts via REST.

    I found something here : Live Backup For Zimbra FOSS Edition #!/Dudi/Gurnadi

    I modified and tested this script on a ZCS 6.02 FOSS.

    I'd like to have the opinion of some other ZCS FOSS admins.

    Here's the script :

    Code:
    #!/bin/bash
    ### RESTORE COMMAND :
    ### zmmailbox -z -m $ACCOUNT postRestURL "//?fmt=tgz&resolve=reset" /backupdir/$ACCOUNT.tgz
    ### START CONFIGURATION ###
    ### Dir for compressed account archives 
    DIR="/tmp/zimbra";
    ### Dir for final backup archive
    OUTPUT="/tmp/zimbra";
    ### Logfile filename (without .log)
    LOGFILE="backlog"
    ### END OF CONFIGURATION ###
    
    USERS=`su - zimbra -c 'zmprov -l gaa'`;
    DATE=`date +%Y%m%d`;
    
    if [ ! -d $DIR ]; then mkdir $DIR; chown zimbra:zimbra $DIR; fi
    cd $DIR;
    if [ ! -d $DATE ]; then mkdir $DATE; chown zimbra:zimbra $DATE; fi
    
    for ACCOUNT in $USERS; do
            SHORTNAME=`echo $ACCOUNT | awk -F. '{print $1}'`;
    		case $SHORTNAME in
    			"ham") echo "Skipping : "$ACCOUNT;
    				echo "Skipping : "$ACCOUNT >> $LOGFILE"_"$DATE.log;;
    			"spam") echo "Skipping : "$ACCOUNT;
    				echo "Skipping : "$ACCOUNT >> $LOGFILE"_"$DATE.log;;
    			*) echo "Backing up : "$ACCOUNT;
    			echo "Backing up : "$ACCOUNT >> $LOGFILE"_"$DATE.log;
    	        su - zimbra -c "zmmailbox -z -m $ACCOUNT getRestURL '//?fmt=tgz' > $DIR/$ACCOUNT.tgz";;
    		esac
    done
    cd $DIR; mkdir $DATE; mv *.tgz $DATE
    echo "Compressing backups in a single archive";
    tar cjpf $OUTPUT/$DATE.tar.bz2 $DATE;
    cd $DIR; rm -rf $DATE
    As a side question, did someone test this script on ZCS 6.08 ?

    Thank you for any input on this crucial subject.
    Last edited by mcordas; 10-27-2010 at 07:42 AM. Reason: mistake in script

Similar Threads

  1. Trouble Sending mail - All Messages deferred!
    By SiteDiscovery in forum Administrators
    Replies: 7
    Last Post: 09-03-2009, 04:52 AM
  2. Hot backup question on open source?
    By cfigurelli in forum Administrators
    Replies: 7
    Last Post: 10-09-2008, 01:43 AM
  3. FYI: ZCS NE backup to fuse/sshfs mount, worked.
    By jagipson in forum Administrators
    Replies: 0
    Last Post: 09-28-2007, 06:37 AM
  4. ZCS 3.2 Beta Available
    By KevinH in forum Announcements
    Replies: 31
    Last Post: 07-07-2006, 03:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •