From ad972f1c71f8f80d84907ea99703974891638ab3 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Tue, 4 Sep 2018 20:34:32 -0600 Subject: [PATCH] Changed exit codes for consistency rather than script order. --- root/scripts/borgbackup.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/root/scripts/borgbackup.sh b/root/scripts/borgbackup.sh index d9101ef..0c3a10e 100755 --- a/root/scripts/borgbackup.sh +++ b/root/scripts/borgbackup.sh @@ -93,7 +93,7 @@ logFile=/var/log/borgbackup.log # echo -e "\e[1;31m[`date +%Y-%m-%d` `date +%H:%M:%S`] This script MUST" \ # "be run as ROOT." # echo -e "\e[4;31mScript aborted\e[0;31m.\e[0m" -# exit 100 +# exit 1 #fi @@ -180,9 +180,10 @@ sudo -u ${webUser} php "${ncroot}/occ maintenance:mode --on" 2>> $logFile if [ "$?" = "0" ]; then echo -e "\e[0;36m...done\e[0m" >> $logFile else - echo -e "\e[1;33m--Warning-- There was a problem putting NextCloud" \ + echo -e "\e[1;31m--Error-- There was a problem putting NextCloud" \ "into maintenance mode" >> $logFile - echo -e "\e[1;39mScript will continue..." >> $logFile + echo -e "\e[4;31mScript aborted\e[0;31m.\e[0m" >> $logFile + exit 100 fi ## Read sqlDetails file and extract necessary information @@ -198,4 +199,8 @@ if [ "$?" = "0" ]; then else echo -e "\e[1;31m--Error-- There was a problem dumping SQL." >> $logFile echo -e "\e[4;31mScript aborted\e[0;31m.\e[0m" >> $logFile + exit 102 fi + +# Gracefully exit +exit 0 \ No newline at end of file