Fix for snapsend.sh:

- If error during sending snapshot to remote host, the script exist on
  the first error instead of sending two mails.
This commit is contained in:
Jeremy Gardais 2014-11-21 15:10:03 +01:00
parent a98cb084ba
commit d0e710ba1e
1 changed files with 5 additions and 1 deletions

View File

@ -112,8 +112,10 @@ case "${interval}" in
printf ' ... DONE\n' >> $LOGFILE
else
# Mail admin
printf 'ERROR snapshot %s does not exist on the local system\n' ${DHOSTSNAP} | mail ${MAILADMIN} -s "snapsend_error $(hostname -f)"
printf 'ERROR Connection SSH or snapshot >%s< does not exist on the local system\n' ${DHOSTSNAP} | mail ${MAILADMIN} -s "snapsend_error $(hostname -f)"
printf 'ERROR snapshot %s for %s does not exist on the local system\n' ${DHOSTSNAP} ${dset} >> $LOGFILE
exit 1
fi
# Test if the snapshot was successfully receive on the remote host
@ -126,6 +128,8 @@ case "${interval}" in
# Mail admin
printf 'ERROR snapshot %s for %s does not exist on the remote host (%s)\n' ${LOCALSNAP} ${dset} ${DHOST} | mail ${MAILADMIN} -s "snapsend_error $(hostname -f)"
printf 'ERROR snapshot %s for %s does not exist on the remote host (%s)\n' ${LOCALSNAP} ${dset} ${DHOST} >> $LOGFILE
exit 1
fi
done