Added ncMaint function to enter/exit NC maint mode

This commit is contained in:
Asif Bacchus 2018-09-07 03:33:56 -06:00
parent a308700086
commit d4340201fe
1 changed files with 25 additions and 0 deletions

View File

@ -219,6 +219,31 @@ function checkExist {
return 105
fi
}
function ncMaint {
if [ "$1" = "on" ]; then
## Put NextCloud in maintenance mode
echo -e "\e[1;36m[`date +%Y-%m-%d` `date +%H:%M:%S`]" \
"Putting NextCloud in maintenance mode...\e[0m" >> $logFile
sudo -u ${webUser} php ${ncroot}/occ maintenance:mode --on \
>> $logFile 2>&1
# return result
maintResult="$?"
return $maintResult
elif [ "$1" = "off" ]; then
## Return NextCloud to normal operating mode
echo -e "\e[1;36m[`date +%Y-%m-%d` `date +%H:%M:%S`]" \
"Exiting NextCloud maintenance mode...\e[0m" >> $logFile
sudo -u ${webUser} php ${ncroot}/occ maintenance:mode --off \
>> $logFile 2>&1
# return result
maintResult="$?"
return $maintResult
else
# this code shouldn't be executed, so note the situation for debugging
return 901
fi
}
### End of functions