mirror of
https://github.com/rvalitov/zabbix-php-fpm.git
synced 2023-11-05 03:30:27 +01:00
[add, fix] cache of PHP run directory
This commit is contained in:
parent
a34ea3ac4d
commit
922e578246
21
tests/all.sh
21
tests/all.sh
@ -10,6 +10,8 @@ MAX_PORTS_COUNT=100
|
|||||||
TEST_SOCKET=""
|
TEST_SOCKET=""
|
||||||
ONDEMAND_TIMEOUT=60
|
ONDEMAND_TIMEOUT=60
|
||||||
ZABBIX_TIMEOUT=20
|
ZABBIX_TIMEOUT=20
|
||||||
|
PHP_SOCKET_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 | head -n1
|
||||||
@ -40,13 +42,19 @@ function getPHPVersion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getEtcPHPDirectory() {
|
function getEtcPHPDirectory() {
|
||||||
|
if [[ -n "$PHP_ETC_DIR" ]]; then
|
||||||
|
echo "$PHP_ETC_DIR"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
LIST_OF_DIRS=(
|
LIST_OF_DIRS=(
|
||||||
"/etc/php/"
|
"/etc/php/"
|
||||||
"/etc/php5/"
|
"/etc/php5/"
|
||||||
)
|
)
|
||||||
for PHP_TEST_DIR in "${LIST_OF_DIRS[@]}"; do
|
for PHP_TEST_DIR in "${LIST_OF_DIRS[@]}"; do
|
||||||
if [[ -d "$PHP_TEST_DIR" ]]; then
|
if [[ -d "$PHP_TEST_DIR" ]]; then
|
||||||
echo "$PHP_TEST_DIR"
|
PHP_ETC_DIR=$PHP_TEST_DIR
|
||||||
|
echo "$PHP_ETC_DIR"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -55,6 +63,11 @@ function getEtcPHPDirectory() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getRunPHPDirectory() {
|
function getRunPHPDirectory() {
|
||||||
|
if [[ -n "$PHP_SOCKET_DIR" ]]; then
|
||||||
|
echo "$PHP_SOCKET_DIR"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
LIST_OF_DIRS=(
|
LIST_OF_DIRS=(
|
||||||
"/run/"
|
"/run/"
|
||||||
"/var/run/"
|
"/var/run/"
|
||||||
@ -62,7 +75,8 @@ function getRunPHPDirectory() {
|
|||||||
for PHP_TEST_DIR in "${LIST_OF_DIRS[@]}"; do
|
for PHP_TEST_DIR in "${LIST_OF_DIRS[@]}"; do
|
||||||
RESULT_DIR=$(find "$PHP_TEST_DIR" -name 'php*-fpm.sock' -type s -exec dirname {} \; 2>/dev/null | sort | head -n1)
|
RESULT_DIR=$(find "$PHP_TEST_DIR" -name 'php*-fpm.sock' -type s -exec dirname {} \; 2>/dev/null | sort | head -n1)
|
||||||
if [[ -d "$RESULT_DIR" ]]; then
|
if [[ -d "$RESULT_DIR" ]]; then
|
||||||
echo "$RESULT_DIR/"
|
PHP_SOCKET_DIR="$RESULT_DIR/"
|
||||||
|
echo "$PHP_SOCKET_DIR"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -165,6 +179,9 @@ setupPools() {
|
|||||||
assertEquals "Failed to find PHP directory" "0" "$EXIT_CODE"
|
assertEquals "Failed to find PHP directory" "0" "$EXIT_CODE"
|
||||||
PHP_LIST=$(sudo find "$PHP_DIR" -name 'www.conf' -type f)
|
PHP_LIST=$(sudo find "$PHP_DIR" -name 'www.conf' -type f)
|
||||||
|
|
||||||
|
#Call to detect and cache PHP run directory, we need to call it before we stop all PHP-FPM
|
||||||
|
getRunPHPDirectory
|
||||||
|
|
||||||
#First we need to stop all PHP-FPM
|
#First we need to stop all PHP-FPM
|
||||||
while IFS= read -r pool; do
|
while IFS= read -r pool; do
|
||||||
if [[ -n $pool ]]; then
|
if [[ -n $pool ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user