zmrestore query

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
padraig
Outstanding Member
Outstanding Member
Posts: 375
Joined: Fri Sep 12, 2014 10:13 pm

zmrestore query

Post by padraig »

if i restore a users ac using:
zmrestore -c -lb full-20071107.211158.xxx -a user@mydomain.com

as per CLI zmrestore Network Edition only - Zimbra :: Wiki

will this keep existing e-mail (using redo logs?) or will the user account be restored to the status in the backup minus new e-mails since the backup.
kirme3
Advanced member
Advanced member
Posts: 179
Joined: Fri Sep 12, 2014 10:09 pm

zmrestore query

Post by kirme3 »

I believe the restore goes to only where the account was at that point in time. Any new messages are lost...someone correct me if I'm wrong.
I usually restore to a new account and imapsync the missing message(s) to the users account. I then delete the restored account.
padraig
Outstanding Member
Outstanding Member
Posts: 375
Joined: Fri Sep 12, 2014 10:13 pm

zmrestore query

Post by padraig »

thanks kirme3

did a quick (&dirty) script to do this.

nb: we need to use the an existing ldap ac( temp_restore which the restored_ac is renamed to ) for the imapsync because

we use external ldap auth.
HTH.


###########################################################

# By Padraig nov 2007

#

# This Script is used to restore an existings uses account

# from a (full) backup and append the mailbox messages

# to the existing mailbox.

# NB: this requires imapsync pre-installed

# and "Enable clear text login"

###########################################################
###########################################################

# required variables

###########################################################

export DOMAIN='@mydomain.com'
export FROM_AC=temp_restore$DOMAIN

export FROM_PASS=temppass

export FROM=`hostname`

export TO=`hostname`
clear

echo -n "Please Input user ID: "

read ID_NO
echo -n "Please Input user PASS: "

read -s PASS

echo -e "
"


echo -e "valid Labes are:
"

su - zimbra -c 'zmrestoreldap -lbs' | grep full

echo -e "
"

echo -n "Please Input the backup (dates) LABEL: "

read LABEL
export TO_ACCOUNT=$ID_NO$DOMAIN
echo Processing $TO_ACCOUNT ...

echo -e \n Please Wait ...
###########################################################

# backup the user just in case

###########################################################

su - zimbra -c 'zmbackup -f -sync -a '$TO_ACCOUNT''
###########################################################

# restore the account from the specified date

# to another account prefioxed with restored_ ...

###########################################################

su - zimbra -c 'zmrestore -c -br -lb '$LABEL' -a '$TO_ACCOUNT' -ca -pre restored_'
###########################################################

# remove the tmp restore ac

###########################################################

su - zimbra -c 'zmprov da '$FROM_AC''
###########################################################

# rename the new restored_ ac to be zrestore. Required for external LDAP auth.

###########################################################

su - zimbra -c 'zmprov ra restored_'$TO_ACCOUNT' '$FROM_AC''
###########################################################

# do the imapsync copy

###########################################################

export SKIPHEAD="'^X-|^Status|^Bcc'" # set the imapsync string "'^X-|^Status|^Bcc'"

imapsync --timeout 30 --nosyncacls --syncinternaldates --host1 $FROM --user1 $FROM_AC --password1 $FROM_PASS --host2 $TO --user2 $TO_ACCOUNT --password2 $PASS --exclude junk --exclude Junk --exclude Trash --exclude trash --split1 500 --split2 500 --skipheader $SKIPHEAD | grep -i total
Post Reply