- echo "*******************************************************"
- echo "* Zimbra - Backup all email accounts *"
- echo "*******************************************************"
- Days=`date +%Y%m%d`;
- before="$(date +%s)"
- cd /DATA/zimbra_backup
- if [ $(date +%u) -eq '6' ]; then
- rm sessions.txt
- rm -r full*
- rm -r inc*
- echo Start time of the full backup = $(date +%T)
- su - zimbra -c "zmbkpose -f"
- after="$(date +%s)"
- cp sessions.txt /DATA/zimbra_backup/BackupToQnap/
- cp -r full-$Days* /DATA/zimbra_backup/BackupToQnap/
- #Zip File For Read Size Not Work. Full Disk#
- #tar -pczf Zimbra_Full_$Days.tar.gz full-$Days* sessions.txt
- #mv Zimbra_Ful_$Days.tar.gz /DATA/zimbra_backup/BackupToQnap/
- #Old Code
- #scp sessions.txt admin@192.168.0.218:/share/backup/
- #scp -r full-$Days* admin@192.168.0.218:/share/backup/
- #scp sessions.txt admin@192.168.2.77:/share/Public/
- #scp -r full-$Days* admin@192.168.2.77:/share/Public/
- else
- echo Start time of the incremental backup = $(date +%T)
- su - zimbra -c "zmbkpose -i"
- after="$(date +%s)"
- tar -pczf Zimbra_Inc_$Days.tar.gz inc-$Days* sessions.txt
- mv Zimbra_Inc_$Days.tar.gz /DATA/zimbra_backup/BackupToQnap/
- #cp sessions.txt /DATA/zimbra_backup/BackupToQnap/
- #cp -r inc-$Days* /DATA/zimbra_backup/BackupToQnap/
- #Old Code
- #scp sessions.txt admin@192.168.0.218:/share/backup/
- #scp -r inc-$Days* admin@192.168.0.218:/share/backup/
- #scp sessions.txt admin@192.168.2.77:/share/Public/
- #scp -r inc-$Days* admin@192.168.2.77:/share/Public/
- fi
- if [ $? -eq 0 ]; then
- echo "*******************************************************"
- echo "=== Transfer COMPLETED ==="
- echo "*******************************************************"
- else
- echo "*******************************************************"
- echo "=== Transfer FAIL! ==="
- echo "*******************************************************"
- fi
- echo The process lasted = $(date +%T)
- # Calculating time
- 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"
- echo "****
cronteb -e
- 10 21 * * 1-5 /DATA/zimbra_backup/autobackup.sh >> /DATA/zimbra_backup/autobackup.log 2>&1
- 00 18 * * 6 /DATA/zimbra_backup/autobackup.sh >> /DATA/zimbra_backup/autobackup.log 2>&1
ไม่มีความคิดเห็น:
แสดงความคิดเห็น