##!/bin/bash
clear
echo Start time of the backup = $(date +%T)
before="$(date +%s)"
## Backup Format
FORMAT=tgz
## Backup location
ZBACKUP=/srv/backup/
## Folder name for backup and using date
DATE=`date +"%d%m%y"`
## Backup location separate by date
ZDUMPDIR=$ZBACKUP/$DATE
## zmmailbox location
ZMBOX=/opt/zimbra/bin/zmmailbox
### Backup Option ###
## Based on few day ago until today, example 7 days ago
#HARI=`date --date='7 days ago' +"%m/%d/%Y"`
#query="&query=after:$HARI"
if [ ! -d $ZDUMPDIR ]; then
mkdir -p $ZDUMPDIR
fi
## Looping Account Zimbra
for account in `su - zimbra -c 'zmprov -l gaa | sort'`
do
echo "Processing mailbox $account backup..."
$ZMBOX -z -m $account getRestURL "//?fmt=${FORMAT}$query" > $ZDUMPDIR/$account.${FORMAT}
done
echo "Zimbra Mailbox backup has been completed successfully."
echo "Sending files to backup all email accounts for Machine2 ..."
rsync -avH $ZBACKUP root@ipaddress:/backup/zimbra_backup_accounts
before2="$(date +%s)"
#
echo The process lasted = $(date +%T)
# Calculating time
after="$(date +%s)"
elapsed="$(expr $after - $before)"
hours=$(($elapsed / 3600))
elapsed=$(($elapsed - $hours * 3600))
minutes=$(($elapsed / 60))
seconds=$(($elapsed - $minutes * 60))
echo The complete backup lasted : "$hours hours $minutes minutes $seconds seconds"
Script backup zimbra mail
Related Posts:
Scripts for backup website ####################################################################### ## AURELIEN HUSSON ## ## Script backup website and Database ## ## Info : ## ## Exemple : website find in /home/www/website/publ… Read More
Script Tự động sao lưu toàn bộ website WordPress Thông thường, khi mình muốn di chuyển hoặc sao lưu một website sử dụng WordPress thì sẽ sử dụng plugin Duplicator. Tuy nhiên, có một số trường hợp server bị lỗi, website không truy cập trực tiếp được hoặc bạn muốn sao l… Read More
MYSQL BAKUP USING SHELLS SCRIPTS Kindly find the MYSQL shells scripts in given below.-------------------------------------------------------------------------------------------------------#! /bin/bash# You are free to modify and distribute this code,# so… Read More
Backup of Zimbra MailBox using zmmailbox This is a short script I use to backup the Zimbra mailbox content for my users. This has been used on a Zimbra Collaboration Server (ZCS Open Source Edition) 7.2 installation, but should work on earlier versions as well. I u… Read More
Script backup zimbra mail##!/bin/bash clear echo Start time of the backup = $(date +%T) before="$(date +%s)" ## Backup Format FORMAT=tgz ## Backup location ZBACKUP=/srv/backup/ ## Folder name for backup and using date DATE=`date +"%d%m%y"` ## Bac… Read More
0 comments:
Post a Comment