Added ncMaint function

This commit is contained in:
Asif Bacchus 2018-09-20 00:04:10 -06:00
parent a7e410970d
commit a4894e39f2

View File

@ -23,8 +23,7 @@ function scriptHelp {
exit 1
}
### quit -- exit the script after logging any errors, warnings, etc. and
### cleaning up as necessary
### quit -- exit the script after logging any errors, warnings, etc.
function quit {
# list generated warnings, if any
if [ ${#exitWarn[@]} -gt 0 ]; then
@ -71,6 +70,25 @@ function checkExist {
fi
}
### ncMaint - perform NextCloud maintenance mode entry and exit
function ncMaint {
if [ "$1" = "on" ]; then
echo -e "${bold}${cyan}${stamp}Putting NextCloud in maintenance" \
"mode..." >> "$logFile"
su -c "php ${ncRoot}/occ maintenance:mode --on" - ${webUser} \
>> "$logFile" 2>&1
maintResult="$?"
return "$maintResult"
elif [ "$1" = "off" ]; then
echo -e "${bold}${cyan}${stamp}Exiting NextCloud maintenance mode..." \
>> "$logFile"
su -c "php ${ncRoot}/occ maintenance:mode --off" - ${webUser} \
>> "$logFile" 2>&1
maintResult="$?"
return "$maintResult"
fi
}
### End of Functions ###