Tampilkan postingan dengan label Zimbra. Tampilkan semua postingan
Tampilkan postingan dengan label Zimbra. Tampilkan semua postingan
 Zimbra Hot Backup Restore Tool

Zimbra Hot Backup Restore Tool

Tool to create and restore backups of Zimbra open source.
Zimbra Backup and Restore "hot". By Richardson Limahttp://br.linkedin.com/in/richardsonlima
Developed in Bash Script, but currently under development in the Python programming language.

BACKUP

Script 1 This script must be run as root, it runs the script runBackupAll.sh and also sends the entire backup to a second machine.
``` echo "***************************************************" echo "* Zimbra - Backup all email accounts *" echo "***************************************************" echo"" # echo Start time of the backup = $(date +%T)
before="$(date +%s)" # echo "" ZHOME=/opt/zimbra ZBACKUP=$ZHOME/backup/mailbox echo "Generating backup files ..." su - zimbra -c "/opt/backup/SCRIPT_ZIBRA_BACKUP_ALL_ACCOUNTS/zimbra_backup_allaccounts.sh" 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 2 zimbraBackupAllAccounts.sh
ZHOME=/opt/zimbra ZBACKUP=$ZHOME/backup/mailbox ZCONFD=$ZHOME/conf DATE=`date +"%a"` ZDUMPDIR=$ZBACKUP/$DATE ZMBOX=/opt/zimbra/bin/zmmailbox if [ ! -d $ZDUMPDIR ]; then mkdir -p $ZDUMPDIR fi echo " Running zmprov ... " for mbox in `zmprov -l gaa` do echo " Generating files from backup $mbox ..." $ZMBOX -z -m $mbox getRestURL "//?fmt=zip" > $ZDUMPDIR/$mbox.zip done

RESTORE

Script 3 This script must be run as root, it runs the script runRestoreAll.sh and also sends the entire backup to machine. zimbra_restore_allaccounts.sh
``` echo "***************************************************" echo "* Zimbra - Restore all email accounts *" echo "***************************************************" echo "" # echo Start Time Restore = $(date +%T)
before="$(date +%s)" # echo "" echo "Starting the process restore the backup files ..." su - zimbra -c "/opt/zimbra_backup_accounts/zimbra_restore_allaccounts.sh" 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 restore lasted : "$hours hours $minutes minutes $seconds seconds" echo "Process completed successfully!" ```
**Script 4 zimbra_restore_allaccounts.sh ```

!/bin/bash

ZHOME=/opt/zimbra

!/bin/bash

ZHOME=/opt/zimbra

ZBACKUP=$ZHOME/backup/mailbox

ZBACKUP=/opt/zimbra_backup_accounts/mailbox ZCONFD=$ZHOME/conf DATE=date +"%a"ZDUMPDIR=$ZBACKUP/$DATE ZMBOX=/opt/zimbra/bin/zmmailbox if [ ! -d $ZDUMPDIR ]; then echo "Backups do not exist !" exit 255; fi for mbox in zmprov -l gaa do echo " Restoring files from backup $mbox ..." $ZMBOX -z -m $mbox postRestURL "//?fmt=zip&resolve=reset" $ZDUMPDIR/$mbox.zip done ```**
Script backup zimbra mail

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"`

## 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"
Tổng hợp các lỗi phổ biến trong Mail Zimbra

Tổng hợp các lỗi phổ biến trong Mail Zimbra

Vào một ngày đẹp trời, tự nhiên hệ thống Mail của công ty bị gặp trục trặc , bạn sẽ cần phải thao tác thật nhanh sao cho hoạt động của hệ thống ổn định trở lại. Vậy đâu là nguyên nhân và cách khắc phục cho những lỗi đó, chúng ta hãy cùng tham khảo những lỗi phổ biến sau nhé.
Bước 1 : Kiểm tra service 
#su zimbra
#zmcontrol status
=> Nếu có lỗi , tiến hành restart dịch vụ bằng câu lệnh sau ”
#zmcontrol restart
= > Nếu service vẫn lỗi, các bạn hãy làm các bước tiếp theo sau
Bước 2 : Tiến hành Backup hệ thống Mail trước khi xử lí lỗi
Bước 3 : Đối chiếu lỗi với danh sách dưới đây để tìm cách khắc phục. 
 Danh sách lỗi phổ biến :
Zimbra_01 ) mta stopped + postfix is not running
Khắc phục :
#service postfix stop
#chkconfig postfix off
#su – zimbra
$zmcontrol restart
Zimbra_02 ) Ldap failed khi setup Zimbra
Khắc phục : 
#vi /etc/sudoers
Tìm đến dòng Defaults requiretty và thêm # đằng trước
#Defaults requiretty
Zimbra_03 ) Starting zmconfigd…/opt/zimbra/bin/zmconfigdctl: line 94: 17418 Killed
Khắc phục :
#su root
#vi /etc/hosts
Thêm # như dòng sau :
##::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#su zimbra
#zmcontrol restart
Zimbra_04 ) stat stoped
Khắc phục :
#vi /etc/hosts
Kiểm tra trong host đã đủ dòng sau chưa :
127.0.0.1 localhost
192.168.1.1 mail.vnitnews.com mail
Zimbra_05 ) mysql , zmconfigd is not running 
Khắc phục :
#zmcontrol stop
#rm -rf /opt/zimbra/db/data/*
#/opt/zimbra/libexec/zmmyinit
#zmcontrol restart
Zimbra_06 ) dnscache is not running
Khắc phục : 
#su zimbra
#zmdnscachectl stop
# zmprov ms `zmhostname` -zimbraServiceEnabled dnscache
# zmprov ms `zmhostname` -zimbraServiceInstalled dnscache
# zmcontrol stop
Zimbra_07 ) Không gửi được mail do IP bị Blacklist (Spam)
Khắc phục :
Kiểm tra IP Mail đang bị Blacklist tại đây
Nếu IP Mail được MxToolBox cảnh báo nhẹ ( < 3 ) tiến hành đăng ký tài khoản để gỡ Blacklist + Rà soát hệ thống Mail bằng file Log hoặc kiểm tra account lạ trong trang quản trị
Nếu bị nặng, cách nhanh nhất là đổi IP cho Mail , tiến hành rà soát hệ thống Mail bằng Log để tìm nguồn phát tán , xóa các account gửi spam , quét virus hệ thống
Zimbra_08 ) /opt/zimbra/bin/ldap: line56: kill No such process
tong-hop-cac-loi-pho-bien-trong-mail-zimbra-01
Khắc phục : 
Tiến hành kiểm tra ổ cứng cho Mail :
#df -h
Tiến hành xóa bớt logs để chạy tạm , hoặc tăng ổ cứng cho hệ thống
Zimbra_09 ) Zimbra zmconfigd not starting/running
Khắc phục : 
#su root
#yum install which
#su zimbra
#rm -rf /opt/zimbra/log/zmconfigd.pid
#zmconfigdctl start
Zimbra_10 ) Diffie-Hellman key khi truy cập 
#su zimbra#zmprov mcf +zimbraSSLExcludeCipherSuites TLS_DHE_RSA_WITH_AES_128_CBC_SHA
#zmprov mcf +zimbraSSLExcludeCipherSuites TLS_DHE_RSA_WITH_AES_256_CBC_SHA
#zmprov mcf +zimbraSSLExcludeCipherSuites SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA
#zmmailboxdctl restart

Backup of Zimbra MailBox using zmmailbox

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 use another script to backup the whole Zimbra installation, but that might be another blog post.

#!/bin/bash -x
# Backup of Zimbra mailboxes using zmmailbox
# Restore of mailbox should be performed using:
# /opt/zimbra/bin/zmmailbox -z -m user@host postRestURL -u https://HOST "//?fmt=tgz&resolve=skip" mailbox-name-date.tgz
BackupFolder="/backup/zimbra"
MailBox="user1 user2 user3 userN"
DateToday=`date -I`
for name in $MailBox
do
sudo -u zimbra /opt/zimbra/bin/zmmailbox -z -m $name@pario.no getRestURL "//?fmt=tgz" > mailbox-$name-$DateToday.tgz
done
The backup files are named mailbox-user1-20120802.tgz mailbox-user2-20120802.tgz …
Cold backup for the Open Source Edition of Zimbra

Cold backup for the Open Source Edition of Zimbra

Today I’ve setup a cold backup routine to backup my Zimba installation running on my Debian (Etch) 4.0 server that is in full production now for my private domains. This is a slightly modified backup script for the Open Source Edition of Zimbra from the Zimbra Wiki. Please note that the script does a full backup every time it’s being run!
#!/bin/bash

# Zimbra Backup Script
# Requires sftp to run
# This script is intended to run from the crontab as root
# Free to use and free of any warranty! Daniel W. Martin, 9 Sept 2007

# 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 -avHK --delete /opt/zimbra/ /backup/zimbra

# 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.

# Stop Zimbra Services
sudo -u zimbra /opt/zimbra/bin/zmcontrol stop
sleep 40

# Sync to backup directory
rsync -avHK --delete /opt/zimbra/ /backup/zimbra

# Restart Zimbra Services
sudo -u zimbra /opt/zimbra/bin/zmcontrol start

# Create a txt file in the backup directory that'll contain the current Zimbra
# server version. Handy for knowing what version of Zimbra a backup can be restored to.
sudo -u zimbra zmcontrol -v > /backup/zimbra/conf/zimbra_version.txt
# or examine your /opt/zimbra/.install_history

# Create archive of backed-up directory for offsite transfer
# cd /backup/zimbra
ZimbraVersion=zimbraBackup-zcs-5.0.1_GA_1902.DEBIAN4.0.20080109200914

tar -zcf /backup/$ZimbraVersion-$(date +"%Y-%m-%d").tgz -C /backup/zimbra .

# Transfer file to backup server using passwordless sftp
scp zimbraBackup-zcs-5.0.1_GA_1902.DEBIAN4.0.20080109200914-$(date +"%Y-%m-%d").tgz username@example.com:/path/to/backupfolder/
I’ve described passwordless ssh/sftp session in a earlier post so I won’t describe the last line of the backup script.

Kategori

Ads

Kategori