occ_file_scan_all_accounts.sh: add support for nginx webservice..
This commit is contained in:
parent
1ed083f60d
commit
0a4997484c
@ -249,19 +249,59 @@ fi
|
||||
DEFAULT_HTTP_USER="www-data"
|
||||
DEFAULT_HTTP_GROUP="www-data"
|
||||
|
||||
NGINX_IS_ENABLED=false
|
||||
APACHE2_IS_ENABLED=false
|
||||
|
||||
# - Determin user/group of the webserver
|
||||
# -
|
||||
httpd_binary="`which httpd`"
|
||||
if [ -z "$httpd_binary" ]; then
|
||||
# Check if NGINX webserver is ctive
|
||||
#
|
||||
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
|
||||
fi
|
||||
if [ -x "$httpd_binary" ];then
|
||||
|
||||
# - Determin websever user
|
||||
# -
|
||||
@ -276,6 +316,19 @@ if [ -x "$httpd_binary" ];then
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user