Zextras Carbonio CE / Zimbra CE backup script


#!/bin/bash
# Run as root
datevar=`date +%Y%m%d%H%M`

# Destination folder. In this example /opt/backups/zextras
mybakdir="/opt/backups/zextras/${datevar}"
mkdir -p $mybakdir
mkdir -p $mybakdir/ldap_bak

# Copy everything but not LDAP
rsync --delete -aHK --exclude 'data.mdb' /opt/zextras $mybakdir

# Backup LDAP
/opt/zextras/common/bin/mdb_copy /opt/zextras/data/ldap/mdb/db $mybakdir/ldap_bak

# Stop Carbonio and backup the locked files
su - zextras -c "/opt/zextras/bin/zmcontrol stop"
/bin/sync

rsync --delete -aHK --exclude 'data.mdb' /opt/zextras $mybakdir

# Start Carbonio and create a tar file & move. In this example we move to /mnt/smb/zextras/
su - zextras -c "/opt/zextras/bin/zmcontrol start"

tar -cf /mnt/smb/zextras/zextras-${datevar}.tar ${mybakdir}


Reference: https://community.zextras.com/forum/carbonio-general-thread/mail-backup-and-restore/


Comments