From 61a47925fb1766b848214d4e375ea9dd75c1d32d Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Tue, 19 Oct 2021 22:11:04 -0400 Subject: [PATCH] replace 'grep -v ...': with '! grep ...' the former wasn't properly checking for success or error state after running ssh --- kaya | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kaya b/kaya index d76f7b3..3eaebd8 100755 --- a/kaya +++ b/kaya @@ -144,10 +144,10 @@ ${kaya_protocol_version} ${password} EOF - # confirm that the SSH session completed - if tail -1 "${log_dump}" | grep -v -e "^KAYA_SUCCESSFUL_BACKUP_MESSAGE" -e "^kaya-client: command exit code" ; then - echo "kaya: backup interrupted or failed to complete" >&2 - exit 1 + # confirm that the SSH session completed (ssh client often exits 0, even if it's killed) + if ! tail -1 "${log_dump}" | grep -q -E -e "^KAYA_SUCCESSFUL_BACKUP_MESSAGE" -e "^kaya-client: command exit code" ; then + echo "kaya: backup interrupted or failed to complete" >&2 + exit 1 fi } -- 2.25.1