<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									rSync Script to backup ZeXtras backup to another server/location via SSH - ZxBackup				            </title>
            <link>https://community.zextras.com/forum/zxbackup/rsync-script-to-backup-zextras-backup-to-another-server-location-via-ssh/</link>
            <description>Zextras Community Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Tue, 21 Jul 2026 13:48:02 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>rSync Script to backup ZeXtras backup to another server/location via SSH</title>
                        <link>https://community.zextras.com/forum/zxbackup/rsync-script-to-backup-zextras-backup-to-another-server-location-via-ssh/#post-1090</link>
                        <pubDate>Tue, 12 May 2015 14:34:17 +0000</pubDate>
                        <description><![CDATA[Hi all,I just had to register here, but I am not a new one to Zimbra and ZeXtras at all. I have started using Zimbra in 2005, when it was still in the infancy.Anyway, I&#039;m not here to tell my...]]></description>
                        <content:encoded><![CDATA[Hi all,<br><br>I just had to register here, but I am not a new one to Zimbra and ZeXtras at all. I have started using Zimbra in 2005, when it was still in the infancy.<br><br>Anyway, I'm not here to tell my story, I'm here to give you one of my scripts - A VERY SIMPLE SCRIPT - which takes the ZeXtras backup your server is doing locally and transfers it over to another server via SSH/rSync ...<br><br>It's well commented, so I won't say more about it, however, I will answer all queries, so just keep asking. Here it is:<br><br>#!/bin/bash

# Zimbra Backup Script v0.0001
# Requires that you have ssh-keys: https://help.ubuntu.com/community/SSHHowto#Public%20key%20authentication
# This script is intended to run from the crontab as root
# Compiled from different resources by Oliver Bross - oliver@bross.eu

# the destination log file
BACKUPLOG="/var/log/rsync-backup.log"
# the destination directory for local backups
# example : DESTLOCAL=/opt/zimbra-backup/
DESTLOCAL=your-destination here
# the destination for remote backups
# example: DESTREMOTE="zimbrabackp.server.net:/Backup/zextras"
DESTREMOTE=and-the-destination-here

# Outputs the time the backup started, for log/tracking purposes
START=$(date +%s)
w
echo ZeXtras Remote rSync Backup &gt; $BACKUPLOG
echo &gt;&gt; $BACKUPLOG
echo Time backup started : $(date +%a) $(date +%T). &gt;&gt; $BACKUPLOG

# Let's write few bits into the log file
echo &gt;&gt; $BACKUPLOG
echo Source : $DESTLOCAL &gt;&gt; $BACKUPLOG
echo Destination : $DESTREMOTE &gt;&gt; $BACKUPLOG
echo Backup Log : $BACKUPLOG &gt;&gt; $BACKUPLOG
echo &gt;&gt; $BACKUPLOG

# Am I root or not?
if ; then
  echo Error: Must be run as root user
  exit 1
fi
 # exit 0

# backup the backup dir to remote
echo Syncing files started &gt;&gt; $BACKUPLOG
rsync -azrtqHK --delete $DESTLOCAL $DESTREMOTE &gt;&gt; $BACKUPLOG 2&gt;&amp;1
echo Syncing of files finished &gt;&gt; $BACKUPLOG
echo "(Any errors would be showsn abowe, if nothing shown, all went accoding to the plan!)" &gt;&gt; $BACKUPLOG
echo &gt;&gt; $BACKUPLOG

# Outputs the time the backup finished
FINISH=$(date +%s)
echo Time backup finished : $(date +%a) $(date +%T). &gt;&gt; $BACKUPLOG

# Lets see how log it all took
echo "Total Backup Time taken :  $(( ($FINISH-$START) / 60 )) minutes, $(( ($FINISH-$START) % 60 )) seconds" &gt;&gt; $BACKUPLOG
echo &gt;&gt; $BACKUPLOG

# Email some details over ... well, email the log file :-)
( echo "Subject: ZeXtras Remote rSync Backup results"; echo; cat $BACKUPLOG ) | /opt/zimbra/postfix/sbin/sendmail youremail@address.com

# end</pre>

ENJOY!

P.S.
just copy everything to whatever.sh file, change permissions to "X" and add schedule in the crontab file!<pre>#!/bin/bash<br><br># Zimbra Backup Script v0.0001<br># Requires that you have ssh-keys: https://help.ubuntu.com/community/SSHHowto#Public%20key%20authentication<br># This script is intended to run from the crontab as root<br># Compiled from different resources by Oliver Bross - oliver@bross.eu<br><br># the destination log file<br>BACKUPLOG="/var/log/rsync-backup.log"<br># the destination directory for local backups<br># example : DESTLOCAL=/opt/zimbra-backup/<br>DESTLOCAL=your-destination here<br># the destination for remote backups<br># example: DESTREMOTE="zimbrabackp.server.net:/Backup/zextras"<br>DESTREMOTE=and-the-destination-here<br><br># Outputs the time the backup started, for log/tracking purposes<br>START=$(date +%s)<br>w<br>echo ZeXtras Remote rSync Backup &gt; $BACKUPLOG<br>echo &gt;&gt; $BACKUPLOG<br>echo Time backup started : $(date +%a) $(date +%T). &gt;&gt; $BACKUPLOG<br><br># Let's write few bits into the log file<br>echo &gt;&gt; $BACKUPLOG<br>echo Source : $DESTLOCAL &gt;&gt; $BACKUPLOG<br>echo Destination : $DESTREMOTE &gt;&gt; $BACKUPLOG<br>echo Backup Log : $BACKUPLOG &gt;&gt; $BACKUPLOG<br>echo &gt;&gt; $BACKUPLOG<br><br># Am I root or not?<br>if ; then<br>echo Error: Must be run as root user<br>exit 1<br>fi<br># exit 0<br><br># backup the backup dir to remote<br>echo Syncing files started &gt;&gt; $BACKUPLOG<br>rsync -azrtqHK --delete $DESTLOCAL $DESTREMOTE &gt;&gt; $BACKUPLOG 2&gt;&amp;1<br>echo Syncing of files finished &gt;&gt; $BACKUPLOG<br>echo "(Any errors would be showsn abowe, if nothing shown, all went accoding to the plan!)" &gt;&gt; $BACKUPLOG<br>echo &gt;&gt; $BACKUPLOG<br><br># Outputs the time the backup finished<br>FINISH=$(date +%s)<br>echo Time backup finished : $(date +%a) $(date +%T). &gt;&gt; $BACKUPLOG<br><br># Lets see how log it all took<br>echo "Total Backup Time taken :  $(( ($FINISH-$START) / 60 )) minutes, $(( ($FINISH-$START) % 60 )) seconds" &gt;&gt; $BACKUPLOG<br>echo &gt;&gt; $BACKUPLOG<br><br># Email some details over ... well, email the log file <img src="/smile.gif" width="" height="" alt=":-)" title=":-)" class="bbcode_smiley" /><br>( echo "Subject: ZeXtras Remote rSync Backup results"; echo; cat $BACKUPLOG ) | /opt/zimbra/postfix/sbin/sendmail youremail@address.com<br><br># end</pre><br><br>ENJOY!<br><br>P.S.<br>just copy everything to whatever.sh file, change permissions to "X" and add schedule in the crontab file!]]></content:encoded>
						                            <category domain="https://community.zextras.com/forum/zxbackup/">ZxBackup</category>                        <dc:creator>bugsysiegel</dc:creator>
                        <guid isPermaLink="true">https://community.zextras.com/forum/zxbackup/rsync-script-to-backup-zextras-backup-to-another-server-location-via-ssh/#post-1090</guid>
                    </item>
							        </channel>
        </rss>
		