Saturday, May 9, 2009

Zimbra backup all users

#!/bin/bash

domain="@my.domain"
backupdir="/root/backup/users"

echo "Start to backup => `date`"

if [ ! -d $backupdir ]; then
echo "$backupdir not existing, create it now automatically"
mkdir -p $backupdir
fi

index=1
sudo -u zimbra /opt/zimbra/bin/zmprov gaa |
while read line; do
echo -n "[$index]backup user : $line..."
username=`echo $line | cut -d@ -f1`
sudo -u zimbra /opt/zimbra/bin/zmmailbox -z -m $line getRestURL "//?fmt=tgz" > $backupdir/$username.tgz
if [ $? -eq 0 ]; then
echo "OK [`du -h $backupdir/$username.tgz | awk '{print $1}'`]"
else
echo "Fail"
fi

index=`expr $index + 1`
done

echo "Backup finish => `date`"

No comments:

 Simple Python Calculator This script will allows your to calculate the integers given with the chosen operation. You can add, substract, mu...