Make service configuring correct for rpm
This commit is contained in:
@@ -58,7 +58,10 @@ else
|
||||
config_path='/etc/clamd.conf'
|
||||
fi
|
||||
if [ -e '/etc/clamd.d/clamd.conf' ]; then
|
||||
config_path='/etc/clamav/clamd.conf'
|
||||
config_path='/etc/clamd.d/clamd.conf'
|
||||
fi
|
||||
if [ -e '/etc/clamd.d/daemon.conf' ]; then
|
||||
config_path='/etc/clamd.d/daemon.conf'
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -67,17 +67,24 @@ csv_list() {
|
||||
|
||||
declare -a versions
|
||||
# List through /etc/php
|
||||
if [ -n "$WEB_BACKEND" ]; then
|
||||
for version in /etc/php/*/fpm; do
|
||||
ver=$(echo "$version" | awk -F"/" '{ print $4 }')
|
||||
if [ -f /etc/redhat-release ]; then
|
||||
for version in /etc/opt/remi/php*/; do
|
||||
ver=$(echo "$version" | awk -F"/" '{ print $5 }' | sed 's|php||')
|
||||
versions+=("$ver")
|
||||
done
|
||||
else
|
||||
# Fix for modphp
|
||||
for version in /etc/php/*/cli; do
|
||||
ver=$(echo "$version" | awk -F"/" '{ print $4 }')
|
||||
versions+=("$ver")
|
||||
done
|
||||
if [ -n "$WEB_BACKEND" ]; then
|
||||
for version in /etc/php/*/fpm; do
|
||||
ver=$(echo "$version" | awk -F"/" '{ print $4 }')
|
||||
versions+=("$ver")
|
||||
done
|
||||
else
|
||||
# Fix for modphp
|
||||
for version in /etc/php/*/cli; do
|
||||
ver=$(echo "$version" | awk -F"/" '{ print $4 }')
|
||||
versions+=("$ver")
|
||||
done
|
||||
fi
|
||||
fi
|
||||
# Listing data
|
||||
case $format in
|
||||
|
||||
@@ -63,10 +63,18 @@ csv_list() {
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Defining config path
|
||||
config_path=$(find /etc/php* -name php.ini)
|
||||
if [ -f /etc/redhat-release ]; then
|
||||
config_path=$(find /etc/opt/remi/php* -name php.ini)
|
||||
else
|
||||
config_path=$(find /etc/php* -name php.ini)
|
||||
fi
|
||||
config_count=$(echo "$config_path" | wc -l)
|
||||
if [ "$config_count" -gt 1 ]; then
|
||||
multiphp_versions=$(ls -d /etc/php/*/fpm/pool.d 2> /dev/null | wc -l)
|
||||
if [ -f /etc/redhat-release ]; then
|
||||
multiphp_versions=$(ls -d /etc/opt/remi/php*/php-fpm.d 2> /dev/null | wc -l)
|
||||
else
|
||||
multiphp_versions=$(ls -d /etc/php/*/fpm/pool.d 2> /dev/null | wc -l)
|
||||
fi
|
||||
if [ "$WEB_BACKEND" = 'php-fpm' ] || [ "$multiphp_versions" -gt 0 ]; then
|
||||
config_path=$(echo "$config_path" | grep fpm)
|
||||
else
|
||||
|
||||
@@ -86,13 +86,23 @@ get_srv_state() {
|
||||
rtime="0"
|
||||
|
||||
# Searching related pids
|
||||
if [ -z $3 ]; then
|
||||
pids=$(pidof $name | tr ' ' '|')
|
||||
if [ -f /etc/redhat-release ] && [ "$name" = "php-fpm" ]; then
|
||||
pids=''
|
||||
for php_pid in $(pidof php-fpm); do
|
||||
process_info=$(ps -p "$php_pid" -o args | tail -n1 | grep "$srv")
|
||||
if [ -n "$process_info" ]; then
|
||||
pids="${pids}|${php_pid}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
pids=$(pidof -x $name | tr ' ' '|')
|
||||
fi
|
||||
if [ -z "$pids" ] && [ "$name" != 'nginx' ]; then
|
||||
pids=$(pgrep $name | tr '\n' '|')
|
||||
if [ -z $3 ]; then
|
||||
pids=$(pidof $name | tr ' ' '|')
|
||||
else
|
||||
pids=$(pidof -x $name | tr ' ' '|')
|
||||
fi
|
||||
if [ -z "$pids" ] && [ "$name" != 'nginx' ]; then
|
||||
pids=$(pgrep $name | tr '\n' '|')
|
||||
fi
|
||||
fi
|
||||
|
||||
# Prevent from an SSH false positive when there is a TTY or SFTP connection but service is down
|
||||
@@ -164,14 +174,25 @@ fi
|
||||
|
||||
# Checking PHP intepreter
|
||||
if [ -n "$WEB_BACKEND" ] && [ "$WEB_BACKEND" != 'remote' ]; then
|
||||
php_versions=$(ls /usr/sbin/php*fpm* | cut -d'/' -f4 | sed 's|php-fpm||')
|
||||
for version in $php_versions; do
|
||||
proc_name="php-fpm${version}"
|
||||
service_name="php${version}-fpm"
|
||||
get_srv_state "$proc_name"
|
||||
data="$data\nNAME='$service_name' SYSTEM='php interpreter' STATE='$state'"
|
||||
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||
done
|
||||
if [ -f /etc/redhat-release ]; then
|
||||
php_versions=$(ls /opt/remi/php*/root/sbin/php-fpm | cut -d'/' -f4 | sed 's|php||')
|
||||
for version in $php_versions; do
|
||||
proc_name="php-fpm"
|
||||
service_name="php${version}"
|
||||
get_srv_state "$proc_name"
|
||||
data="$data\nNAME='$service_name-php-fpm' SYSTEM='php interpreter' STATE='$state'"
|
||||
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||
done
|
||||
else
|
||||
php_versions=$(ls /usr/sbin/php*fpm* | cut -d'/' -f4 | sed 's|php-fpm||')
|
||||
for version in $php_versions; do
|
||||
proc_name="php-fpm${version}"
|
||||
service_name="php${version}-fpm"
|
||||
get_srv_state "$service_name" "$proc_name"
|
||||
data="$data\nNAME='$service_name' SYSTEM='php interpreter' STATE='$state'"
|
||||
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Checking WEB Proxy
|
||||
@@ -210,6 +231,11 @@ if [ -n "$ANTIVIRUS_SYSTEM" ] && [ "$ANTIVIRUS_SYSTEM" != 'remote' ]; then
|
||||
if [ "$ANTIVIRUS_SYSTEM" == 'clamav' ]; then
|
||||
ANTIVIRUS_SYSTEM='clamd'
|
||||
fi
|
||||
if [ -f /etc/redhat-release ]; then
|
||||
if [ "$ANTIVIRUS_SYSTEM" == 'clamav-daemon' ]; then
|
||||
ANTIVIRUS_SYSTEM='clamd'
|
||||
fi
|
||||
fi
|
||||
get_srv_state "$ANTIVIRUS_SYSTEM"
|
||||
else
|
||||
if [ "$ANTIVIRUS_SYSTEM" == 'clamav-daemon' ]; then
|
||||
|
||||
@@ -24,11 +24,11 @@ fi
|
||||
php_DIR="/run/php"
|
||||
#make php directory in /var/run/directory for php-fpm and for hestia-php
|
||||
if [ -f /etc/redhat-release ]; then
|
||||
user_apache=$(cat $HESTIA_INSTALL_DIR/php-fpm/multiphp.tpl | grep listen.group | cut -d= -f2 | xargs)
|
||||
if [ -n "$user_apache" ]; then
|
||||
if grep -q "$user_apache" /etc/passwd; then
|
||||
if grep -q "$user_apache" /etc/group; then
|
||||
if [ ! -e "$php_DIR" ]; then
|
||||
if [ ! -e "$php_DIR" ]; then
|
||||
user_apache=$(cat $HESTIA_INSTALL_DIR/php-fpm/multiphp.tpl | grep listen.group | cut -d= -f2 | xargs)
|
||||
if [ -n "$user_apache" ]; then
|
||||
if grep -q "$user_apache" /etc/passwd; then
|
||||
if grep -q "$user_apache" /etc/group; then
|
||||
mkdir "$php_DIR"
|
||||
chmod 755 "$php_DIR"
|
||||
chown "$user_apache":"$user_apache" "$php_DIR"
|
||||
|
||||
@@ -38,6 +38,10 @@ if [ "$DEBUG_MODE" = "true" ]; then
|
||||
log="/var/log/hestia/debug.log"
|
||||
fi
|
||||
|
||||
if [ "$service" = "cron" ] && [ -f /etc/redhat-release ]; then
|
||||
service="crond"
|
||||
fi
|
||||
|
||||
# Multi-instance service restart request handling
|
||||
if [ "$service" = "php-fpm" ]; then
|
||||
service_list=''
|
||||
|
||||
Reference in New Issue
Block a user