mod_php_install.sh: show existing FPM pool definitions in summary.

This commit is contained in:
Christoph 2024-01-03 14:11:09 +01:00
parent 7b17ac342a
commit dae3f913bb

View File

@ -77,6 +77,10 @@ _CRONTAB_BAKUP_FILE="$(mktemp)"
_VSERVER_GUEST=no
# Array oft existing FPM pool definitions
#
declare -a php_fpm_pool_definition_file_arr=()
_backup_date="$(date +%Y%m%d-%H%M)"
@ -802,39 +806,50 @@ if $WITH_PHP_FPM_SUPPORT ; then
# If php pool definitions exists on installed php, then take that value
#
if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then
__pm_start_servers=$(grep -e "^\s*pm.start_servers" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}')
if [[ -n "$__pm_start_servers" ]] ; then
DEFAULT_FPM_POOL_START_SERVER=$__pm_start_servers
if [[ -d "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/" ]]; then
if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then
__pm_start_servers=$(grep -e "^\s*pm.start_servers" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}')
if [[ -n "$__pm_start_servers" ]] ; then
DEFAULT_FPM_POOL_START_SERVER=$__pm_start_servers
fi
fi
fi
if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then
__pm_min_spare_servers=$(grep -e "^\s*pm.min_spare_servers" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}')
if [[ -n "$__pm_min_spare_servers" ]] ; then
DEFAULT_FPM_POOL_MIN_SPARE=$__pm_min_spare_servers
if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then
__pm_min_spare_servers=$(grep -e "^\s*pm.min_spare_servers" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}')
if [[ -n "$__pm_min_spare_servers" ]] ; then
DEFAULT_FPM_POOL_MIN_SPARE=$__pm_min_spare_servers
fi
fi
fi
if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then
__pm_max_spare_servers=$(grep -e "^\s*pm.max_spare_servers" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}')
if [[ -n "$__pm_max_spare_servers" ]] ; then
DEFAULT_FPM_POOL_MAX_SPARE=$__pm_max_spare_servers
if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then
__pm_max_spare_servers=$(grep -e "^\s*pm.max_spare_servers" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}')
if [[ -n "$__pm_max_spare_servers" ]] ; then
DEFAULT_FPM_POOL_MAX_SPARE=$__pm_max_spare_servers
fi
fi
fi
if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then
__pm_max_requests=$(grep -e "^\s*pm.max_requests" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}')
if [[ -n "$__pm_max_requests" ]] ; then
DEFAULT_FPM_POOL_MAX_REQUESTS=$__pm_max_requests
if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then
__pm_max_requests=$(grep -e "^\s*pm.max_requests" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}')
if [[ -n "$__pm_max_requests" ]] ; then
DEFAULT_FPM_POOL_MAX_REQUESTS=$__pm_max_requests
fi
fi
fi
if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then
__pm_max_children=$(grep -e "^\s*pm.max_children" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}')
if [[ -n "$__pm_max_children" ]] ; then
DEFAULT_FPM_POOL_MAX_CHILDREN=$__pm_max_children
if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then
__pm_max_children=$(grep -e "^\s*pm.max_children" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}')
if [[ -n "$__pm_max_children" ]] ; then
DEFAULT_FPM_POOL_MAX_CHILDREN=$__pm_max_children
fi
fi
# Get existing FPM pool definitions
#
for _file in $(ls "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/") ; do
[[ "${_file}" =~ conf$ ]] || continue
[[ "${_file}" = "www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] && continue
php_fpm_pool_definition_file_arr+=("${_file}")
done
fi
@ -2149,10 +2164,10 @@ if $WITH_PHP_FPM_SUPPORT ; then
echo " PHP socket .......................: $FPM_DEFAULT_POOL_LISTEN"
echo ""
echo " PHP FPM Socket definition(s)......: ${FPM_DEFAULT_POOL}.php-fpm.conf"
if [[ ${#existing_fpm_definition_arr[@]} -gt 0 ]] ; then
for _file in "${existing_fpm_definition_arr[@]}" ; do
if [[ ${#php_fpm_pool_definition_file_arr[@]} -gt 0 ]] ; then
for _file in "${php_fpm_pool_definition_file_arr[@]}" ; do
[[ "$(basename "$_file")" = "${FPM_DEFAULT_POOL}.php-fpm.conf" ]] && continue
echo " $(basename "$_file")"
echo " $(basename "$_file")"
done
fi