From 6ebbb262d542ff9dd65cb3663540568d7a743acd Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Fri, 7 Sep 2018 02:23:02 -0600 Subject: [PATCH] Changed script exit to list all warnings in array variable (code 100) --- root/scripts/borgbackup.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/root/scripts/borgbackup.sh b/root/scripts/borgbackup.sh index 7324131..341ef57 100755 --- a/root/scripts/borgbackup.sh +++ b/root/scripts/borgbackup.sh @@ -142,7 +142,7 @@ function quit { elif [ "$2" = "warn" ]; then # exit with warning code echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`]" \ - "--Script exiting with WARNING (code: $1)--\e[0m" >> $logFile + "--Script exiting with WARNING(S) (code: ${exitWarning[*]})--\e[0m" >> $logFile exit "$1" else # exit with error code @@ -423,9 +423,11 @@ fi ## Log completion of script -echo -e "\e[1;32m[`date +%Y-%m-%d` `date +%H:%M:%S`]" \ - "--Backup operations completed--\e[0m" >> $logFile +if [ ${#exitWarning[@]} -gt 0 ]; then + quit 100 warn +else + quit +fi - -# Gracefully exit -exit 0 \ No newline at end of file +# end of script -- this exit should not be necessary +exit 999 \ No newline at end of file