From d0e710ba1efaf71244e062eb9b0207afb143ea98 Mon Sep 17 00:00:00 2001 From: Gardais Jeremy Date: Fri, 21 Nov 2014 15:10:03 +0100 Subject: [PATCH] Fix for snapsend.sh: - If error during sending snapshot to remote host, the script exist on the first error instead of sending two mails. --- snapsend.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/snapsend.sh b/snapsend.sh index e910094..2ed237c 100755 --- a/snapsend.sh +++ b/snapsend.sh @@ -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