Skip to content

Commit e3ae954

Browse files
author
Kristan Kenney
committed
List php-fpm instances individually
1 parent 46abfde commit e3ae954

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

bin/v-list-sys-services

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,14 @@ fi
162162

163163
# Checking WEB Backend
164164
if [ ! -z "$WEB_BACKEND" ] && [ "$WEB_BACKEND" != 'remote' ]; then
165-
proc_name=$(ls /usr/sbin/php*fpm* | rev | cut -d'/' -f 1 | rev)
166-
get_srv_state $proc_name
167-
data="$data\nNAME='$WEB_BACKEND' SYSTEM='backend server' STATE='$state'"
168-
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
165+
php_versions=$(ls /usr/sbin/php*fpm* | cut -d'/' -f4 | sed 's|php-fpm||')
166+
for version in $php_versions; do
167+
proc_name="php-fpm${version}"
168+
service_name="php${version}-fpm"
169+
get_srv_state $proc_name
170+
data="$data\nNAME='$service_name' SYSTEM='backend server' STATE='$state'"
171+
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
172+
done
169173
fi
170174

171175
# Checking WEB Proxy

bin/v-restart-service

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,20 @@ is_format_valid 'service' 'restart'
3333
# Action #
3434
#----------------------------------------------------------#
3535

36+
# Get installed php versions
37+
php_versions=$(ls /usr/sbin/php*fpm* | cut -d'/' -f4 | sed 's|php-fpm||')
38+
39+
# Substitute php-fpm service name formats
40+
for version in $php_versions; do
41+
if [ "$service" = "php-fpm${version}" ]; then
42+
service="php${version}-fpm"
43+
fi
44+
done
45+
46+
# Multi-instance service restart request handling
3647
if [ "$service" = "php-fpm" ];then
37-
for php_ver in $(multiphp_versions); do
38-
service_list="${service_list} php${php_ver}-fpm"
48+
for version in $php_versions; do
49+
service_list="${service_list} php${version}-fpm"
3950
done
4051
else
4152
service_list="$service"
@@ -61,6 +72,7 @@ for service in $service_list; do
6172
"$service" = "php7.2-fpm" -o \
6273
"$service" = "php7.3-fpm" -o \
6374
"$service" = "php7.4-fpm" -o \
75+
"$service" = "php8.0-fpm" -o \
6476
"$service" = "proftpd" -o \
6577
"$service" = "ssh" -o \
6678
"$service" = "fail2ban" ]; then

web/restart/service/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
exec (HESTIA_CMD."v-update-firewall", $output, $return_var);
1818
} else {
1919
$v_service = escapeshellarg($_GET['srv']);
20-
exec (HESTIA_CMD."v-restart-service ".$v_service, $output, $return_var);
20+
exec (HESTIA_CMD."v-restart-service ".$v_service. " yes", $output, $return_var);
2121
}
2222
}
2323
if ($return_var != 0) {

web/templates/admin/list_services.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,17 @@
140140
<? } else {?>
141141
<i class="fas fa-minus-circle status-icon red icon-pad-right"></i>
142142
<? } ?>
143-
<b><a href="/edit/server/<? echo $key ?>/" title="<?=_('edit')?>: <?=$key?>"><?=$key?></a></b>
143+
<? if (($key == "php5.6-fpm") || ($key == "php7.0-fpm") || ($key == "php7.1-fpm") || ($key == "php7.2-fpm") || ($key == "php7.3-fpm") || ($key == "php7.4-fpm") || ($key == "php8.0-fpm")) {
144+
$edit_url="php";
145+
} else {
146+
$edit_url=$key;
147+
}?>
148+
<b><a href="/edit/server/<? echo $edit_url ?>/" title="<?=_('edit')?>: <?=$key?>"><?=$key?></a></b>
144149
</div>
145150
<div class="clearfix l-unit__stat-col--left text-center compact-2">
146151
<div class="actions-panel clearfix">
147152
<div class="actions-panel__col actions-panel__edit shortcut-enter" key-action="href">
148-
<a href="/edit/server/<? echo $key ?>/" title="<?=_('edit')?>"><i class="fas fa-pencil-alt status-icon orange status-icon dim icon-large"></i></a>
153+
<a href="/edit/server/<? echo $edit_url ?>/" title="<?=_('edit')?>"><i class="fas fa-pencil-alt status-icon orange status-icon dim icon-large"></i></a>
149154
</div>
150155
<div class="actions-panel__col actions-panel__stop shortcut-s" key-action="js">
151156
<a id="<?=$spnd_action ?>_link_<?=$i?>" class="data-controls do_servicerestart" title="<?=_('restart')?>">

0 commit comments

Comments
 (0)