mirror of
https://github.com/rvalitov/zabbix-php-fpm.git
synced 2023-11-05 03:30:27 +01:00
[fix] port calculation
This commit is contained in:
parent
cbaff4a688
commit
e81131bbcd
@ -85,14 +85,14 @@ setupPool() {
|
|||||||
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 "7.3" | cut -d : -f 1)
|
PHP_SERIAL_ID=$(find /etc/php/ -maxdepth 1 -mindepth 1 -type d | sort | grep -n -F "$PHP_VERSION" | 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)
|
||||||
for ((c = 1; c <= MAX_PORTS; c++)); do
|
for ((c = 1; c <= MAX_PORTS; c++)); do
|
||||||
POOL_NAME="port$c"
|
POOL_NAME="port$c"
|
||||||
POOL_PORT=$(echo "($START_PORT + $c)/1" | bc)
|
POOL_PORT=$(echo "($START_PORT + $c)/1" | bc)
|
||||||
PORT_IS_BUSY=$(sudo lsof -i:$POOL_PORT)
|
PORT_IS_BUSY=$(sudo lsof -i:"$POOL_PORT")
|
||||||
assertNull "Port $POOL_PORT is busy" "$PORT_IS_BUSY"
|
assertNull "Port $POOL_PORT is busy" "$PORT_IS_BUSY"
|
||||||
copyPool "$POOL_FILE" "$POOL_NAME" "$POOL_PORT" "static"
|
copyPool "$POOL_FILE" "$POOL_NAME" "$POOL_PORT" "static"
|
||||||
done
|
done
|
||||||
@ -101,7 +101,7 @@ setupPool() {
|
|||||||
POOL_NAME="localhost"
|
POOL_NAME="localhost"
|
||||||
POOL_PORT=$(echo "($MIN_PORT + $PHP_SERIAL_ID * $MAX_PORTS_COUNT)/1" | bc)
|
POOL_PORT=$(echo "($MIN_PORT + $PHP_SERIAL_ID * $MAX_PORTS_COUNT)/1" | bc)
|
||||||
POOL_SOCKET="127.0.0.1:$POOL_PORT"
|
POOL_SOCKET="127.0.0.1:$POOL_PORT"
|
||||||
PORT_IS_BUSY=$(sudo lsof -i:$POOL_PORT)
|
PORT_IS_BUSY=$(sudo lsof -i:"$POOL_PORT")
|
||||||
assertNull "Port $POOL_PORT is busy" "$PORT_IS_BUSY"
|
assertNull "Port $POOL_PORT is busy" "$PORT_IS_BUSY"
|
||||||
copyPool "$POOL_FILE" "$POOL_NAME" "$POOL_SOCKET" "static"
|
copyPool "$POOL_FILE" "$POOL_NAME" "$POOL_SOCKET" "static"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user