diff --git a/root/scripts/borgbackup.sh b/root/scripts/borgbackup.sh index 8cab7a9..fb2d0b8 100755 --- a/root/scripts/borgbackup.sh +++ b/root/scripts/borgbackup.sh @@ -155,33 +155,39 @@ function quit { function checkExist { if [ "$1" = "find" ]; then if [ -e "$3" ]; then - echo -e "\e[0mFound: \e[0;33m${3}\e[0m" >> $logFileVerbose + echo -e "\e[0m[`date +%Y-%m-%d` `date +%H:%M:%S`] Found:" \ + "\e[0;33m${3}\e[0m" >> $logFileVerbose return 0 elif [ "$2" = "createDir" ]; then - echo -e "\e[1;36mCreating: ${3}...\e[0m" | tee -a $logFileVerbose \ - $logFileNormal > /dev/null + echo -e "\e[1;36m[`date +%Y-%m-%d` `date +%H:%M:%S`] Creating:" \ + "${3}...\e[0m" | tee -a $logFileVerbose $logFileNormal > \ + /dev/null mkdir -p "$3" 2>&1 | tee -a $logFileVerbose $logFileNormal \ > /dev/null echo -e "\e[0;36m...done\e[0m" | tee -a $logFileVerbose \ $logFileNormal > /dev/null return 1 elif [ "$2" = "warn" ]; then - echo -e "\e[1;33m---WARNING: ${3} was not found---\e[0m" | \ - tee -a $logFileVerbose $logFileNormal $logFileQuiet > /dev/null + echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`] ---WARNING:" \ + "${3} was not found---\e[0m" | tee -a $logFileVerbose \ + $logFileNormal $logFileQuiet > /dev/null exitWarning=101 return 2 elif [ "$2" = "error" ]; then - echo -e "\e[1;31m---ERROR: ${3} was not found---\e[0m" | \ - tee -a $logFileVerbose $logFileNormal $logFileQuiet > /dev/null + echo -e "\e[1;31m[`date +%Y-%m-%d` `date +%H:%M:%S`] ---ERROR:" \ + "${3} was not found---\e[0m" | tee -a $logFileVerbose \ + $logFileNormal $logFileQuiet > /dev/null quit 101 fi elif [ "$1" = "verify" ]; then if [ -e "$2" ]; then - echo -e "\e[0mConfirmed: \e[0;33m${2}\e[0m" >> $logFileVerbose + echo -e "\e[0m[`date +%Y-%m-%d` `date +%H:%M:%S`]Confirmed:" \ + "\e[0;33m${2}\e[0m" >> $logFileVerbose return 0 else - echo -e "\e[1;31m---ERROR: Problem creating ${2}---\e[0m" | \ - tee -a $logFileVerbose $logFileNormal $logFileQuiet > /dev/null + echo -e "\e[1;31m[`date +%Y-%m-%d` `date +%H:%M:%S`] ---ERROR:" \ + "Problem creating ${2}---\e[0m" | tee -a $logFileVerbose \ + $logFileNormal $logFileQuiet > /dev/null quit 102 fi fi