Use local php. Part 3

This commit is contained in:
Alexey Berezhok
2025-01-18 15:55:12 +03:00
parent 2f91eee76d
commit f3b9d33016
10 changed files with 161 additions and 139 deletions

View File

@@ -86,7 +86,7 @@ get_srv_state() {
rtime="0"
# Searching related pids
if [ -f /etc/redhat-release ] && [ "$name" = "php-fpm" ]; then
if [ "$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")
@@ -174,8 +174,8 @@ fi
# Checking PHP intepreter
if [ -n "$WEB_BACKEND" ] && [ "$WEB_BACKEND" != 'remote' ]; then
if [ -f /etc/redhat-release ]; then
php_versions=$(ls /opt/remi/php*/root/sbin/php-fpm | cut -d'/' -f4 | sed 's|php||')
if [ "$LOCAL_PHP" == "yes" ]; then
php_versions=$(/opt/brepo/php*/sbin/php-fpm | cut -d'/' -f4 | sed 's|php||')
for version in $php_versions; do
proc_name="php-fpm"
service_name="php${version}"
@@ -184,12 +184,12 @@ if [ -n "$WEB_BACKEND" ] && [ "$WEB_BACKEND" != 'remote' ]; then
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
done
else
php_versions=$(ls /usr/sbin/php*fpm* | cut -d'/' -f4 | sed 's|php-fpm||')
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${version}"
service_name="php${version}-fpm"
get_srv_state "$service_name" "$proc_name"
data="$data\nNAME='$service_name' SYSTEM='php interpreter' STATE='$state'"
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
fi