Add snippet 'get-webservice-environment.sh' and change related code..
This commit is contained in:
parent
a335d51975
commit
17eaf8e278
@ -285,103 +285,9 @@ fi
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
# Check PHP Version
|
||||
#
|
||||
|
@ -285,103 +285,9 @@ fi
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
# Check PHP Version
|
||||
#
|
||||
|
@ -285,103 +285,9 @@ fi
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
# Check PHP Version
|
||||
#
|
||||
|
@ -293,106 +293,14 @@ if [[ "$DATABASE_TYPE" = "postgres" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
|
||||
# Check PHP Version
|
||||
#
|
||||
|
@ -294,106 +294,14 @@ if [[ "$DATABASE_TYPE" = "postgres" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
|
||||
# Check PHP Version
|
||||
#
|
||||
|
@ -293,106 +293,14 @@ if [[ "$DATABASE_TYPE" = "postgres" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
|
||||
# Check PHP Version
|
||||
#
|
||||
|
@ -266,106 +266,14 @@ fi
|
||||
DEFAULT_HTTP_USER="www-data"
|
||||
DEFAULT_HTTP_GROUP="www-data"
|
||||
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
|
||||
if [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then
|
||||
PHP_BIN="/usr/local/php/bin/php"
|
||||
|
@ -279,106 +279,14 @@ fi
|
||||
DEFAULT_HTTP_USER="www-data"
|
||||
DEFAULT_HTTP_GROUP="www-data"
|
||||
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
|
||||
if [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then
|
||||
PHP_BIN="/usr/local/php/bin/php"
|
||||
|
@ -284,106 +284,14 @@ fi
|
||||
DEFAULT_HTTP_USER="www-data"
|
||||
DEFAULT_HTTP_GROUP="www-data"
|
||||
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
|
||||
if [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then
|
||||
PHP_BIN="/usr/local/php/bin/php"
|
||||
|
@ -284,106 +284,14 @@ fi
|
||||
DEFAULT_HTTP_USER="www-data"
|
||||
DEFAULT_HTTP_GROUP="www-data"
|
||||
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
|
||||
if [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then
|
||||
PHP_BIN="/usr/local/php/bin/php"
|
||||
|
@ -216,37 +216,11 @@ if [[ -z "$WEBSITE" ]] ; then
|
||||
# -
|
||||
IFS=$'\n' website_arr=($(sort <<<"${unsorted_website_arr[*]}"))
|
||||
|
||||
WEBSITE=
|
||||
_OK=false
|
||||
echo ""
|
||||
echo "Which site would you like to update?"
|
||||
echo ""
|
||||
declare -i i=0
|
||||
for _site in ${website_arr[@]} ; do
|
||||
IFS=':' read -a _arr <<< ${_site}
|
||||
echo " [$i] ${_arr[0]}"
|
||||
((i++))
|
||||
done
|
||||
echo
|
||||
echononl " Eingabe: "
|
||||
while ! $_OK ; do
|
||||
read _IN
|
||||
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
|
||||
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
|
||||
conf_file=${_arr[1]}
|
||||
_WEBSITE="${_arr[0]}"
|
||||
_OK=true
|
||||
else
|
||||
echo ""
|
||||
echo -e "\tFalsche Eingabe !"
|
||||
echo ""
|
||||
echononl " Eingabe: "
|
||||
fi
|
||||
done
|
||||
|
||||
WEBSITE="$_WEBSITE"
|
||||
# Which cloud instance (website) would you like to update
|
||||
#
|
||||
source ${snippet_dir}/get-cloud-instance-to-update
|
||||
|
||||
#fatal "No website ios given on commandline - Missing Parameter '-s <website>'"
|
||||
fi
|
||||
|
||||
|
||||
@ -313,103 +287,10 @@ DEFAULT_HTTP_GROUP="www-data"
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
|
||||
if [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then
|
||||
PHP_BIN="/usr/local/php/bin/php"
|
||||
|
@ -321,106 +321,14 @@ if [[ "$DATABASE_TYPE" = "postgres" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
|
||||
# Check PHP Version
|
||||
#
|
||||
|
@ -282,106 +282,14 @@ if [[ "$DATABASE_TYPE" = "postgres" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
|
||||
# Check PHP Version
|
||||
#
|
||||
|
@ -282,106 +282,14 @@ if [[ "$DATABASE_TYPE" = "postgres" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
|
||||
fi
|
||||
|
||||
# Check PHP Version
|
||||
#
|
||||
|
@ -287,97 +287,13 @@ if [[ "$DATABASE_TYPE" = "postgres" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
|
||||
# Check PHP Version
|
||||
|
97
snippets/get-webservice-environment.sh
Normal file
97
snippets/get-webservice-environment.sh
Normal file
@ -0,0 +1,97 @@
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$HTTP_USER
|
||||
fi
|
@ -372,108 +372,13 @@ if [[ "$DATABASE_TYPE" = "postgres" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# Check if NGINX webserver is ctive
|
||||
# Get Webservice environment as IS_HTTPD_RUNNING, HTTP_USER, HTTP_GROUP..
|
||||
#
|
||||
if $(systemctl -q is-enabled nginx 2> /dev/null) ; then
|
||||
|
||||
NGINX_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
nginx_binary="$(which nginx)"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
nginx_binary="$(ps -axu | grep -E "nginx:.*master" | grep -v grep | grep -o -E "\S+/nginx")"
|
||||
if [[ -z "$nginx_binary" ]] ; then
|
||||
if [[ -x "/usr/local/nginx/bin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/bin/nginx"
|
||||
elif [[ -x "/usr/local/nginx/sbin/nginx" ]]; then
|
||||
nginx_binary="/usr/local/nginx/sbin/nginx"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$nginx_binary" ]] ; then
|
||||
_HTTP_USER="$($nginx_binary -T 2> /dev/null | grep -E "^\s*user\s+\S+;" | grep -o -E "\S+;$" | sed -e 's/;$//')"
|
||||
fi
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $nginx_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
|
||||
|
||||
elif $(systemctl -q is-enabled apache2 2> /dev/null) ; then
|
||||
|
||||
APACHE2_IS_ENABLED=true
|
||||
|
||||
# - Determin user of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||
httpd_binary="/usr/local/apache2/bin/httpd"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
_HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
_HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
|
||||
|
||||
# - Is webserver running ?
|
||||
# -
|
||||
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}X" = "XX" ]] ;then
|
||||
IS_HTTPD_RUNNING=false
|
||||
else
|
||||
IS_HTTPD_RUNNING=true
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
error "Neither \033[1mapache2\033[m nor \033[1mnginx\033[m is enabled on this machine"
|
||||
|
||||
echononl "continue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Interrupted by user"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -n "$_HTTP_USER" ]] ; then
|
||||
if [[ -n "$HTTP_USER" ]] && [[ "$_HTTP_USER" != "$HTTP_USER" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_USER}\033[m as Webservers user. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_USER}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_USER=$_HTTP_USER
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
|
||||
fi
|
||||
|
||||
if [[ -n "$_HTTP_GROUP" ]] ; then
|
||||
if [[ -n "$HTTP_GROUP" ]] && [[ "$_HTTP_GROUP" != "$HTTP_GROUP" ]]; then
|
||||
warn "The script has determined \033[1;37m${_HTTP_GROUP}\033[m as Webservers group. This\n value differs from the value given in your configuration file, \n which is \033[1;37m${HTTP_GROUP}\033[m and takes precedence."
|
||||
else
|
||||
HTTP_GROUP=$_HTTP_GROUP
|
||||
fi
|
||||
else
|
||||
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$HTTP_USER
|
||||
fi
|
||||
source ${snippet_dir}/get-webservice-environment.sh
|
||||
|
||||
|
||||
# Check PHP Version
|
||||
|
Loading…
Reference in New Issue
Block a user