update_nextcloud.sh: support nginx webserver.

This commit is contained in:
Christoph 2021-04-11 12:47:13 +02:00
parent 2cf20e4294
commit 9e38b08a0e

View File

@ -382,6 +382,14 @@ if [[ "$DATABASE_TYPE" = "postgres" ]]; then
fi
fi
# Check if NGINX webserver is ctive
#
if $(systemctl -q is-active nginx) ; then
NGINX_IS_ACTIVE=true
else
NGINX_IS_ACTIVE=false
fi
# Check PHP Version
#
if [[ "$PHP_ENGINE" = "FPM" ]] ; then
@ -623,22 +631,52 @@ fi
# -
echo ""
echononl " Stop Apache Webserver.."
if $SYSTEMD_EXISTS ; then
systemctl stop apache2
if [[ $? -eq 0 ]]; then
echo_ok
if $IS_HTTPD_RUNNING ; then
if $SYSTEMD_EXISTS ; then
systemctl stop apache2
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
fatal "$(cat $log_file)"
fi
else
echo_failed
fatal "$(cat $log_file)"
/etc/init.d/apache2 stop
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
fatal "$(cat $log_file)"
fi
fi
else
/etc/init.d/apache2 stop
if [[ $? -eq 0 ]]; then
echo_ok
echo_skipped
fi
# - Stop Nginx Webservice
# -
echo ""
echononl " Stop Nginx Webserver.."
if $NGINX_IS_ACTIVE ; then
if $SYSTEMD_EXISTS ; then
systemctl stop apache2
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
fatal "$(cat $log_file)"
fi
else
echo_failed
fatal "$(cat $log_file)"
/etc/init.d/apache2 stop
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
fatal "$(cat $log_file)"
fi
fi
else
echo_skipped
fi
echo ""
@ -1331,6 +1369,53 @@ else
warn "The webserver was not running, so it will be keept down!"
fi
# - Start NGINX Webservise
# -
echo ""
echononl " Start Nginx Webserver.."
if $NGINX_IS_ACTIVE ; then
if $SYSTEMD_EXISTS ; then
systemctl start nginx > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interrupted by user."
fi
else
/etc/init.d/nginx start > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interrupted by user."
fi
fi
else
echo_skipped
warn "The NGINX is not configured as active - so nothing to do."
fi
_redis_cli_bin="$(which redis-cli)"
if [[ -z "$_redis_cli_bin" ]]; then
if [[ -x "/usr/local/bin/redis-cli" ]]; then