3
0
mirror of https://github.com/rvalitov/zabbix-php-fpm.git synced 2023-11-05 03:30:27 +01:00

[fix] PHP locations

This commit is contained in:
Ramil Valitov 2020-07-21 16:14:15 +03:00
parent 922e578246
commit 3e1b672fde
No known key found for this signature in database
GPG Key ID: 2AB186DABDFE1914

View File

@ -14,13 +14,13 @@ PHP_SOCKET_DIR=""
PHP_ETC_DIR="" PHP_ETC_DIR=""
function getUserParameters() { function getUserParameters() {
sudo find /etc/zabbix/ -name 'userparameter_php_fpm.conf' -type f | head -n1 sudo find /etc/zabbix/ -name 'userparameter_php_fpm.conf' -type f 2>/dev/null | sort | head -n1
} }
function restoreUserParameters() { function restoreUserParameters() {
PARAMS_FILE=$(getUserParameters) PARAMS_FILE=$(getUserParameters)
sudo rm -f $PARAMS_FILE sudo rm -f $PARAMS_FILE
sudo cp "$TRAVIS_BUILD_DIR/zabbix/userparameter_php_fpm.conf" "$(sudo find /etc/zabbix/ -name 'zabbix_agentd*.d' -type d | head -n1)" sudo cp "$TRAVIS_BUILD_DIR/zabbix/userparameter_php_fpm.conf" "$(sudo find /etc/zabbix/ -name 'zabbix_agentd*.d' -type d 2>/dev/null | sort | head -n1)"
} }
function AddSleepToConfig() { function AddSleepToConfig() {
@ -118,6 +118,8 @@ setupPool() {
EXIT_CODE=$? EXIT_CODE=$?
assertEquals "Failed to find PHP run directory" "0" "$EXIT_CODE" assertEquals "Failed to find PHP run directory" "0" "$EXIT_CODE"
PHP_DIR=$(getEtcPHPDirectory)
#Delete all active pools except www.conf: #Delete all active pools except www.conf:
sudo find "$POOL_DIR" -name '*.conf' -type f -not -name 'www.conf' -exec rm -rf {} \; sudo find "$POOL_DIR" -name '*.conf' -type f -not -name 'www.conf' -exec rm -rf {} \;
@ -133,17 +135,17 @@ setupPool() {
for ((c = 1; c <= MAX_POOLS; c++)); do for ((c = 1; c <= MAX_POOLS; c++)); do
POOL_NAME="dynamic$c" POOL_NAME="dynamic$c"
POOL_SOCKET="/run/php/php${PHP_VERSION}-fpm-${POOL_NAME}.sock" POOL_SOCKET="${PHP_RUN_DIR}php${PHP_VERSION}-fpm-${POOL_NAME}.sock"
copyPool "$POOL_FILE" "$POOL_NAME" "$POOL_SOCKET" "dynamic" copyPool "$POOL_FILE" "$POOL_NAME" "$POOL_SOCKET" "dynamic"
done done
for ((c = 1; c <= MAX_POOLS; c++)); do for ((c = 1; c <= MAX_POOLS; c++)); do
POOL_NAME="ondemand$c" POOL_NAME="ondemand$c"
POOL_SOCKET="/run/php/php${PHP_VERSION}-fpm-${POOL_NAME}.sock" POOL_SOCKET="${PHP_RUN_DIR}php${PHP_VERSION}-fpm-${POOL_NAME}.sock"
copyPool "$POOL_FILE" "$POOL_NAME" "$POOL_SOCKET" "ondemand" copyPool "$POOL_FILE" "$POOL_NAME" "$POOL_SOCKET" "ondemand"
done done
PHP_SERIAL_ID=$(find /etc/php/ -maxdepth 1 -mindepth 1 -type d | sort | grep -n -F "$PHP_VERSION" | cut -d : -f 1) PHP_SERIAL_ID=$(find "$PHP_DIR" -maxdepth 1 -mindepth 1 -type d | sort | grep -n -F "$PHP_VERSION" | head -n1 | cut -d : -f 1)
#Create TCP port based pools #Create TCP port based pools
#Division on 1 is required to convert from float to integer #Division on 1 is required to convert from float to integer
START_PORT=$(echo "($MIN_PORT + $PHP_SERIAL_ID * $MAX_PORTS_COUNT + 1)/1" | bc) START_PORT=$(echo "($MIN_PORT + $PHP_SERIAL_ID * $MAX_PORTS_COUNT + 1)/1" | bc)