3 Commits

Author SHA1 Message Date
Asif Bacchus 8efaed6bb7 fixed incorrect spacing after stamp to resolve logwatch errs 2019-01-30 11:57:10 -07:00
Asif Bacchus ec36c5ca12 fixed incorrectly quoted variables causing cmd errors 2019-01-30 11:50:25 -07:00
Asif Bacchus 3b7722ab56 quoted all variable expansions to handle spaces properly 2019-01-30 10:13:36 -07:00
+11 -11
View File
@@ -120,7 +120,7 @@ function quit {
for errCode in "${exitError[@]}"; do for errCode in "${exitError[@]}"; do
errStamp="${errCode%%_*}" errStamp="${errCode%%_*}"
errValue="${errCode##*_}" errValue="${errCode##*_}"
echo -e "${err}${errStamp}-- [ERROR] ${errorExplain[$errValue]}" \ echo -e "${err}${errStamp} -- [ERROR] ${errorExplain[$errValue]}" \
"(code: ${errValue}) --${normal}" >> "$logFile" "(code: ${errValue}) --${normal}" >> "$logFile"
done done
exit 2 exit 2
@@ -151,7 +151,7 @@ function checkExist {
### ncMaint - pass requested mode change type to NextCloud occ ### ncMaint - pass requested mode change type to NextCloud occ
function ncMaint { function ncMaint {
sudo -u ${webUser} php ${ncRoot}/occ maintenance:mode --$1 \ sudo -u "${webUser}" php "${ncRoot}/occ" maintenance:mode --"$1" \
>> "$logFile" 2>&1 >> "$logFile" 2>&1
maintResult="$?" maintResult="$?"
return "$maintResult" return "$maintResult"
@@ -381,8 +381,8 @@ if [ -z "$webUser" ]; then
exit 1 exit 1
# Check if supplied webUser account exists # Check if supplied webUser account exists
elif [ -n "$webUser" ]; then elif [ -n "$webUser" ]; then
user_exists=$(id -u $webUser > /dev/null 2>&1; echo $?) user_exists=$(id -u "$webUser" > /dev/null 2>&1; echo $?)
if [ $user_exists -ne 0 ]; then if [ "$user_exists" -ne 0 ]; then
echo -e "\n${err}The supplied webuser account (-u parameter) does not" \ echo -e "\n${err}The supplied webuser account (-u parameter) does not" \
"exist.${normal}\n" "exist.${normal}\n"
exit 1 exit 1
@@ -429,9 +429,9 @@ fi
### Log start of script operations ### Log start of script operations
echo -e "${note}[$(stamp)]--- Start $scriptName execution ---${normal}" \ echo -e "${note}[$(stamp)] --- Start $scriptName execution ---${normal}" \
>> "$logFile" >> "$logFile"
echo -e "${info}[$(stamp)]-- [INFO] Log file located at ${lit}${logFile}${info}" \ echo -e "${info}[$(stamp)] -- [INFO] Log file located at ${lit}${logFile}${info}" \
"--${normal}" >> "$logFile" "--${normal}" >> "$logFile"
@@ -706,17 +706,17 @@ if [ -z "$borgExclude" ]; then
echo -e "${info}[$(stamp)] --[INFO] Executing borg without exclusions --" \ echo -e "${info}[$(stamp)] --[INFO] Executing borg without exclusions --" \
"${normal}" >> "$logFile" "${normal}" >> "$logFile"
borg --show-rc create ${borgCreateParams} ::`date +%Y-%m-%d_%H%M%S` \ borg --show-rc create ${borgCreateParams} ::`date +%Y-%m-%d_%H%M%S` \
${xtraFiles[@]} \ "${xtraFiles[@]}" \
${sqlDumpDir} ${ncDataDir} \ "${sqlDumpDir}" "${ncDataDir}" \
2>> "$logFile" 2>> "$logFile"
else else
# borgExclude is not empty # borgExclude is not empty
echo -e "${info}[$(stamp)] --[INFO] Executing borg with exclusions --" \ echo -e "${info}[$(stamp)] --[INFO] Executing borg with exclusions --" \
"${normal}" >> "$logFile" "${normal}" >> "$logFile"
borg --show-rc create ${borgCreateParams} --exclude-from ${borgExclude} \ borg --show-rc create ${borgCreateParams} --exclude-from "${borgExclude}" \
::`date +%Y-%m-%d_%H%M%S` \ ::`date +%Y-%m-%d_%H%M%S` \
${xtraFiles[@]} \ "${xtraFiles[@]}" \
${sqlDumpDir} ${ncDataDir} \ "${sqlDumpDir}" "${ncDataDir}" \
2>> "$logFile" 2>> "$logFile"
fi fi