Para 70GB em uma rede 1Gb o backup está levando 1:16 sendo 26 minutos com os serviços desligados.
É só criar o script e adicionar ao Cron.
#!/bin/bash
# Zimbra Backup Script
# This script is intended to run from the crontab as root
# Date outputs and su vs sudo corrections by other contributors, thanks, sorry I don't have names to attribute!
# Free to use and free of any warranty! Daniel W. Martin, 5 Dec 2008
# Modified by Patrick Sarnighausen, 20 Dec 2010
# changed ftp to rsync through nfs
# Outputs the time the backup started, for log/tracking purposes
echo Horario de inicio do Backup = $(date +%T) > /mnt/nfsbackup/"Backup-`date +%F`.txt"
before="$(date +%s)"
# Live sync before stopping Zimbra to minimize sync time with the services down
# Comment out the following line if you want to try single cold-sync only
rsync -avogtHK --delete /opt/zimbra/ /mnt/nfsbackup/zimbrabkp/
# which is the same as: /opt/zimbra /backup
# Including --delete option gets rid of files in the dest folder that don't exist at the src
# this prevents logfile/extraneous bloat from building up overtime.
# Now we need to shut down Zimbra to rsync any files that were/are locked
# whilst backing up when the server was up and running.
before2="$(date +%s)"
echo Desligando o Servidor as: $(date +%T) >> /mnt/nfsbackup/"Backup-`date +%F`.txt"
# Stop Zimbra Services
su - zimbra -c "/opt/zimbra/bin/zmcontrol stop"
sleep 30
# Kill any orphaned Zimbra processes
kill -9 `ps -u zimbra -o "pid="`
# Only enable the following command if you need all Zimbra user owned
# processes to be killed before syncing
# ps auxww | awk '{print $1" "$2}' | grep zimbra | kill -9 `awk '{print $2}'`
# Sync to backup directory
rsync -avogtHK --delete /opt/zimbra/ /mnt/nfsbackup/zimbrabkp/
# Restart Zimbra Services
su - zimbra -c "/opt/zimbra/bin/zmcontrol start"
# Calculates and outputs amount of time the server was down for
after="$(date +%s)"
elapsed="$(expr $after - $before2)"
hours=$(($elapsed / 3600))
elapsed=$(($elapsed - $hours * 3600))
minutes=$(($elapsed / 60))
seconds=$(($elapsed - $minutes * 60))
echo Servidor esteve desligado por: "$hours horas $minutes minutos $seconds segundos" >> /mnt/nfsbackup/"Backup-`date +%F`.txt"
# Create a txt file in the backup directory that'll contains the current Zimbra
# server version. Handy for knowing what version of Zimbra a backup can be restored to.
version=`su - zimbra -c "zmcontrol -v"`
echo Versao do Zimbra: $version >> /mnt/nfsbackup/"Backup-`date +%F`.txt"
# or examine your /opt/zimbra/.install_history
# Display Zimbra services status
echo Exibindo status dos servicos Zimbra... >> /mnt/nfsbackup/"Backup-`date +%F`.txt"
zstatus=`su - zimbra -c "zmcontrol status"`
echo $zstatus >> /mnt/nfsbackup/"Backup-`date +%F`.txt"
# Create archive of backed-up directory for offsite transfer
# cd /backup/zimbra
#tar -zcvf /tmp/mail.backup.tgz -C /backup/zimbra .
# Transfer file to backup server
#ncftpput -u -p / /tmp/mail.backup.tgz
# Outputs the time the backup finished
echo Horario final do backup = $(date +%T) >> /mnt/nfsbackup/"Backup-`date +%F`.txt"
# Calculates and outputs total time taken
after="$(date +%s)"
elapsed="$(expr $after - $before)"
hours=$(($elapsed / 3600))
elapsed=$(($elapsed - $hours * 3600))
minutes=$(($elapsed / 60))
seconds=$(($elapsed - $minutes * 60))
echo Duracao Backup: "$hours horas $minutes minutos $seconds segundos" >> /mnt/nfsbackup/"Backup-`date +%F`.txt"
sleep 5
mail email@dominio.com -s "Zimbra Backup-`date +%F`" < /mnt/nfsbackup/"Backup-`date +%F`.txt"
Nenhum comentário:
Postar um comentário