Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/zmbkpose
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,12 @@ incremental_all_accounts ()

for MAIL in $(grep @ $LISTALLACCOUNTS); do
FULLEXISTS=""
FULLEXISTS=$(grep $MAIL $WORKDIR/sessions.txt | grep ^full)
FULLEXISTS=$(grep ":${MAIL}:" $WORKDIR/sessions.txt | grep ^full)
if [ -z "$FULLEXISTS" ]; then
echo " $MAIL doesn't have previos full backup. Executing now..."
backup_accounts $MAIL
else
INCFROM=$(grep $MAIL $WORKDIR/sessions.txt | grep -v ^WARN | tail -1 | awk -F: '{print $3}')
INCFROM=$(grep ":${MAIL}:" $WORKDIR/sessions.txt | grep -v ^WARN | tail -1 | awk -F: '{print $3}')
if [ "$INCFROM" = "$(date +%m/%d/%y)" ]; then
echo "WARN: $MAIL already has backup today. Nothing to do." | tee -a $WORKDIR/sessions.txt
else
Expand Down Expand Up @@ -472,15 +472,15 @@ incremental_accounts ()
break
else
FULLEXISTS=""
FULLEXISTS=$(grep $MAIL $WORKDIR/sessions.txt | grep ^full)
FULLEXISTS=$(grep ":${MAIL}:" $WORKDIR/sessions.txt | grep ^full)

if [ -z "$FULLEXISTS" ]; then
echo " $MAIL doesn't have previos full backup. Executing now..."
backup_accounts $MAIL $SESSION
((K = K+1))
else
$(which ldapsearch) -x -H $LDAPMASTERSERVER -D $LDAPZIMBRADN -w $LDAPZIMBRAPASS -b '' -LLL "(zimbraMailDeliveryAddress=$MAIL)" > $TEMPDIR/$MAIL.ldiff
INCFROM=$(grep $MAIL $WORKDIR/sessions.txt | grep -v ^WARN | tail -1 | awk -F: '{print $3}')
INCFROM=$(grep ":${MAIL}:" $WORKDIR/sessions.txt | grep -v ^WARN | tail -1 | awk -F: '{print $3}')

if [ "$INCFROM" = "$(date +%m/%d/%y)" ]; then
echo "WARN: $MAIL already has backup today. Nothing to do." | tee -a $WORKDIR/sessions.txt
Expand Down Expand Up @@ -531,7 +531,7 @@ restore_accounts ()
break
fi

grep $MAIL $WORKDIR/sessions.txt | grep -v ^WARN: > $BKPSACCOUNT
grep ":${MAIL}:" $WORKDIR/sessions.txt | grep -v ^WARN: > $BKPSACCOUNT

if ! [ -s $BKPSACCOUNT ]; then
echo "$MAIL: No backup found. Impossible to restor"
Expand Down Expand Up @@ -580,7 +580,7 @@ restore_on_box()

if [ -n $DEST ]; then

grep $MAIL $WORKDIR/sessions.txt | grep -e ^inc- -e ^full- > $BKPSACCOUNT
grep ":${MAIL}:" $WORKDIR/sessions.txt | grep -e ^inc- -e ^full- > $BKPSACCOUNT
if ! [ -s $BKPSACCOUNT ]; then
echo "$MAIL: No backup found. Impossible to restore."
exit 1
Expand Down Expand Up @@ -627,7 +627,7 @@ restore_LDAP_account ()
echo "Account $MAIL exists. Use zmbkpose -r $MAIL SESSION_name."
((K = K+1))
else
grep $MAIL $WORKDIR/sessions.txt | grep -e ^inc- -e ^full- > $BKPSACCOUNT
grep ":${MAIL}:" $WORKDIR/sessions.txt | grep -e ^inc- -e ^full- > $BKPSACCOUNT
if ! [ -s $BKPSACCOUNT ]; then
echo "$MAIL: No backup found. Impossible to restore."
((K = K+1))
Expand Down