Results 1 to 3 of 3

Thread: Backup to Amazon S3

Hybrid View

  1. #1
    Join Date
    Apr 2008
    Rep Power

    Default Backup to Amazon S3


    Here's a little script I whipped up, based on the 'simple shell script' on the Wiki to backup to Amazon S3 service. This presumes that you have the s3sync ruby package installed and configured.


    # System Backup Script, include Zimbra Backup
    # Requires s3sync (with s3cmd) to run

    # Live sync before stopping Zimbra to minimize sync time with the services down
    rsync -avHK --delete /opt/zimbra/ /backup/zimbra

    # Stop the Zimbra Services
    sudo -u zimbra /opt/zimbra/bin/zmcontrol stop
    sleep 20

    # Sync to backup directory
    rsync -avHK --delete /opt/zimbra/ /backup/zimbra

    # Restart the Zimbra service
    sudo -u zimbra /opt/zimbra/bin/zmcontrol start
    sleep 20

    # Include a text file with the current Zimbra version
    sudo -u zimbra zmcontrol -v > /backup/zimbra/conf/zimbra_version.txt

    # Create a tarball of the backup folder
    timestamp=`(date +%F_%H.%M.%S)`
    tar -zcvf /tmp/backup_${timestamp}_zimbra.tgz -C /backup/zimbra .

    # Upload to S3
    echo "Beginning upload to S3"
    /root/s3sync/s3sync/s3cmd.rb put bucket:backup_${timestamp}_zimbra.tgz /tmp/backup_${timestamp}_zimbra.tgz
    echo "Uploaded to S3"

    # Remove the uploaded file
    rm /tmp/backup_${timestamp}_zimbra.tgz
    Obviously, replace bucket with a bucket of your choice.

    ~ Christopher

  2. #2
    Join Date
    May 2007
    Rep Power


    I'm using the network edition, so could I do something like:

    Backup to a local drive, then when the backup is complete set it to automatically upload a copy of the backup to amazon?

    Thanks for the script!!


  3. #3
    Join Date
    May 2008
    Rep Power


    Is your zipped backup under 5GB since amazon has a 5GB limitation on objects? If not, how are you getting around that limitation?


Similar Threads

  1. Replies: 658
    Last Post: 04-04-2014, 09:01 AM
  2. Keeping a backup server synced with live server
    By Q-Mike in forum Administrators
    Replies: 5
    Last Post: 04-11-2008, 01:40 PM
  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. Backup best practice
    By Eyfi in forum Administrators
    Replies: 2
    Last Post: 06-29-2007, 07:52 AM
  5. NE Backup best practises
    By Klug in forum Administrators
    Replies: 3
    Last Post: 05-29-2006, 08:32 AM

Posting Permissions

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