24,7 → 24,7 |
# Developer: oSource Development(as of 2009-07-01) |
# DevTeam: Marcus Uddenhed |
# Version: 1.0.7 |
# Updated: 2015-12-14 22:17 |
# Updated: 2016-04-01 15:30 |
# |
|
#### Global Settings #### |
36,7 → 36,7 |
ZimLogEnable=yes # Turns logging on or off(yes/no). |
ZimLogLogRotate=no # Enables log rotating(yes/no) |
ZimLogRotateInt=day # How often should we rotate logs(day, week or month) |
ZimLogPath=/opt/logs # Folder for log files |
ZimLogPath=/opt/backup/logs # Folder for log files |
ZimLogVerbose=no # Activates extra logging information(yes/no) |
|
#### File Transfer Settings #### |
147,12 → 147,19 |
} |
|
full_backup() { |
# Cleaning LDAP database from backup folder if exist. |
if [ -f "$ZimDiffTmpPath/$ZimHome/data/ldap/mdb/db/data.mdb" ]; |
then |
rm $ZimDiffTmpPath/$ZimHome/data/ldap/mdb/db/data.mdb |
fi |
|
# Making backup |
if [ $ZimLogEnable = 'yes' ] && [ $ZimLogVerbose = 'yes' ] |
then |
|
# Hot sync before shutdown on zimbra folder |
echo "`date "+%Y-%m-%d %H:%M:%S"` - Hot syncing to backup folder..." >> $ZimLogFile |
rsync -avHK --delete $ZimInstPath/$ZimHome $ZimFullTmpPath >> $ZimLogFile |
rsync -avHK --delete --exclude 'data/ldap/mdb/db/data.mdb' $ZimInstPath/$ZimHome $ZimFullTmpPath >> $ZimLogFile |
echo "`date "+%Y-%m-%d %H:%M:%S"` - Hot syncing to backup folder done." >> $ZimLogFile |
|
# Stopping Zimbra |
160,7 → 167,9 |
|
# Cold sync of zimbra folder |
echo "`date "+%Y-%m-%d %H:%M:%S"` - Cold syncing to backup folder..." >> $ZimLogFile |
rsync -avHK --delete $ZimInstPath/$ZimHome $ZimFullTmpPath >> $ZimLogFile |
rsync -avHK --delete --exclude 'data/ldap/mdb/db/data.mdb' $ZimInstPath/$ZimHome $ZimFullTmpPath >> $ZimLogFile |
# Special LDAP DB copying needed. |
$ZimInstPath/$ZimHome/openldap/bin/mdb_copy $ZimInstPath/$ZimHome/data/ldap/mdb/db $ZimFullTmpPath/$ZimHome/data/ldap/mdb/db >> $ZimLogFile |
echo "`date "+%Y-%m-%d %H:%M:%S"` - Cold syncing to backup folder done." >> $ZimLogFile |
|
# Starting Zimbra |
179,13 → 188,15 |
else |
|
# Hot sync before shutdown on zimbra folder |
rsync -avHK --delete $ZimInstPath/$ZimHome $ZimFullTmpPath |
rsync -avHK --delete --exclude 'data/ldap/mdb/db/data.mdb' $ZimInstPath/$ZimHome $ZimFullTmpPath |
|
# Stopping Zimbra |
zimbra_stop |
|
# Cold sync of zimbra folder |
rsync -avHK --delete $ZimInstPath/$ZimHome $ZimFullTmpPath |
rsync -avHK --delete --exclude 'data/ldap/mdb/db/data.mdb' $ZimInstPath/$ZimHome $ZimFullTmpPath |
# Special LDAP DB copying needed. |
$ZimInstPath/$ZimHome/openldap/bin/mdb_copy $ZimInstPath/$ZimHome/data/ldap/mdb/db $ZimFullTmpPath/$ZimHome/data/ldap/mdb/db |
|
# Starting Zimbra |
zimbra_start |
199,16 → 210,24 |
} |
|
diff_backup() { |
# Checking if LDAP database folder exist and fix it. |
if [ ! -f "$ZimDiffTmpPath/$ZimHome/data/ldap/mdb/db/data.mdb" ]; |
then |
if [ ! -d "$ZimDiffTmpPath/$ZimHome/data/ldap/mdb/db" ] |
then |
mkdir -p $ZimDiffTmpPath/$ZimHome/data/ldap/mdb/db |
fi |
else |
rm -R $ZimDiffTmpPath/$ZimHome/data/ldap/mdb/db/data.mdb |
fi |
|
# Make backup |
if [ $ZimLogEnable = 'yes' ] && [ $ZimLogVerbose = 'yes' ] |
then |
# Cleaning backup folder |
#echo "`date "+%Y-%m-%d %H:%M:%S"` - Cleaning backup folder..." >> $ZimLogFile |
#rm -r -f $ZimDiffTmpPath/* >> $ZimLogFile |
#echo "`date "+%Y-%m-%d %H:%M:%S"` - Cleaning backup folder done." >> $ZimLogFile |
|
# Hot syncing to backup folder |
echo "`date "+%Y-%m-%d %H:%M:%S"` - Hot syncing to backup folder..." >> $ZimLogFile |
rsync -avHK --compare-dest=$ZimFullTmpPath/ $ZimInstPath/$ZimHome $ZimDiffTmpPath >> $ZimLogFile |
rsync -avHK --exclude 'data/ldap/mdb/db/data.mdb' --compare-dest=$ZimFullTmpPath/ $ZimInstPath/$ZimHome $ZimDiffTmpPath >> $ZimLogFile |
echo "`date "+%Y-%m-%d %H:%M:%S"` - Hot syncing to backup folder done." >> $ZimLogFile |
|
# Stopping Zimbra |
216,17 → 235,14 |
|
# Cold syncing to backup folder |
echo "`date "+%Y-%m-%d %H:%M:%S"` - Cold syncing to backup folder..." >> $ZimLogFile |
rsync -avHK --compare-dest=$ZimFullTmpPath/ $ZimInstPath/$ZimHome $ZimDiffTmpPath >> $ZimLogFile |
rsync -avHK --exclude 'data/ldap/mdb/db/data.mdb' --compare-dest=$ZimFullTmpPath/ $ZimInstPath/$ZimHome $ZimDiffTmpPath >> $ZimLogFile |
# Special LDAP DB copying needed. |
$ZimInstPath/$ZimHome/openldap/bin/mdb_copy $ZimInstPath/$ZimHome/data/ldap/mdb/db $ZimDiffTmpPath/$ZimHome/data/ldap/mdb/db >> $ZimLogFile |
echo "`date "+%Y-%m-%d %H:%M:%S"` - Cold syncing to backup folder done." >> $ZimLogFile |
|
# Starting Zimbra |
zimbra_start |
|
# Syncing backup folders |
#echo "`date "+%Y-%m-%d %H:%M:%S"` - Syncing backup folders..." >> $ZimLogFile |
#cp -R $ZimDiffTmpPath/* $ZimFullTmpPath/ >> $ZimLogFile |
#echo "`date "+%Y-%m-%d %H:%M:%S"` - Syncing backup folders done." >> $ZimLogFile |
|
# Compressing backup folder |
echo "`date "+%Y-%m-%d %H:%M:%S"` - Compressing backup folder..." >> $ZimLogFile |
tar -zcvpf $ZimBackupPath/$ZimBackupFile -C $ZimBackupPath td zimbra_version.txt >> $ZimLogFile |
236,20 → 252,18 |
|
# Hot sync before shutdown on zimbra folder |
#rm -R $ZimDiffTmpPath/* |
rsync -avHK --compare-dest=$ZimFullTmpPath/ $ZimInstPath/$ZimHome $ZimDiffTmpPath |
rsync -avHK --exclude 'data/ldap/mdb/db/data.mdb' --compare-dest=$ZimFullTmpPath/ $ZimInstPath/$ZimHome $ZimDiffTmpPath |
|
# Stopping Zimbra |
zimbra_stop |
|
# Cold sync of zimbra folder |
rsync -avHK --compare-dest=$ZimFullTmpPath/ $ZimInstPath/$ZimHome $ZimDiffTmpPath |
|
rsync -avHK --exclude 'data/ldap/mdb/db/data.mdb' --compare-dest=$ZimFullTmpPath/ $ZimInstPath/$ZimHome $ZimDiffTmpPath |
# Special LDAP DB copying needed. |
$ZimInstPath/$ZimHome/openldap/bin/mdb_copy $ZimInstPath/$ZimHome/data/ldap/mdb/db $ZimDiffTmpPath/$ZimHome/data/ldap/mdb/db |
# Starting Zimbra |
zimbra_start |
|
# Syncing files from diff to full backup folder |
#cp -R $ZimDiffTmpPath/* $ZimFullTmpPath/ |
|
# Compressing backup for space reduction |
tar -zcvpf $ZimBackupPath/$ZimBackupFile -C $ZimBackupPath td zimbra_version.txt |
fi |
559,14 → 573,6 |
fi |
} |
|
full_restore() { |
echo "Full Restore under development" |
} |
|
diff_restore() { |
echo "Diff Restore under development" |
} |
|
backup_file() { |
# Checks what backup is choosen and sets file-name appropiate |
|