From 9fed8511eee266416c35ef27398f20fb910237c3 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Thu, 6 Sep 2018 00:26:33 -0600 Subject: [PATCH] Added logging verbosity parameter detection and logfile variable setup. --- root/scripts/borgbackup.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/root/scripts/borgbackup.sh b/root/scripts/borgbackup.sh index 4f1d20b..6d58fe8 100755 --- a/root/scripts/borgbackup.sh +++ b/root/scripts/borgbackup.sh @@ -139,6 +139,29 @@ echo -e "\e[1;32m[`date +%Y-%m-%d` `date +%H:%M:%S`]" \ scriptPath="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" err503FullPath="$scriptPath/$err503FileName" +## Determine verbosity level for logging +if [ "$1" = "verbose" ]; then + borgCreateParams='--list --stats' + borgPruneParams='--list' + logFileVerbose="$logFile" + unset logFileNormal + unset logFileQuiet +elif [ "$1" = "normal" ] || [ -z "$1" ]; then + borgCreateParams='--stats' + borgPruneParams='--list' + unset logFileVerbose + logFileNormal="$logFile" + unset logFileQuiet +elif [ "$1" = "quiet" ]; then + unset borgCreateParams + unset borgPruneParams + unset logFileVerbose + unset logFileNormal + logFileQuiet="$logFile" +else + quit 2 +fi + ## Export logfle location for use by external programs export logFile="$logFile"