#!/bin/bash
domain="@my.domain"
backupdir="/root/backup/users"
if [ $# -ne 2 ]; then
echo "Usage: $0 account [reset, skip]"
exit 1
fi
case "$2" in
reset)
OPTION="reset"
;;
skip)
OPTION="skip"
;;
*)
echo "Usage: $0 account [reset, skip]"
exit 3
esac
echo "Start to restore => `date`"
echo -n "Check account [$1] ==> "
sudo -u zimbra /opt/zimbra/bin/zmprov ga $1$domain > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "NO, [$1] not exist"
exit 2
else
echo "Yes, we have [$1]"
fi
echo -n "Check backup data for [$1] ==> "
if [ ! -e $backupdir/$1.tgz ]; then
echo "No, no backup data for [$1]"
exit 3
else
echo "Yes, backup data for [$1] exists"
fi
echo -n "Start to restore user [$1] ==> "
sudo -u zimbra /opt/zimbra/bin/zmmailbox -z -m $1$domain postRestURL "//?fmt=tgz&resolve=$OPTION" $backupdir/$1.tgz
if [ $? -eq 0 ]; then
echo "OK"
else
echo "Fail"
fi
echo "Restore finish => `date`"
Windows and linux information and one stop centre for myself. Having difficulties to remember all things at once. This blog will remain be my references on the internet. Other people can take benefit from it. Thank you for visiting
Subscribe to:
Post Comments (Atom)
Simple Python Calculator This script will allows your to calculate the integers given with the chosen operation. You can add, substract, mu...
-
when trying to apt-get update i got this error message :- W: There is no public key available for the following key IDs xxxxxxxxxxxx t...
-
Skrip ini aku guna kat server aku.. backup mysql setiap hari. Hanya perlu ubah pada bahagian setting sahaja. chmod dan set cron untuk daily ...
-
This tutorial will help you get AWStats and Lighttpd working together. AWStats is an excellent log analyzer, and works well with Lighttpd. T...
No comments:
Post a Comment