mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 23:08:07 +00:00
Fix connection mechanism between Chronometer and FTL
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
ae1a59285d
commit
e033ee6664
@ -13,6 +13,7 @@ LC_NUMERIC=C
|
|||||||
|
|
||||||
# Retrieve stats from FTL engine
|
# Retrieve stats from FTL engine
|
||||||
pihole-FTL() {
|
pihole-FTL() {
|
||||||
|
local ftl_port LINE
|
||||||
ftl_port=$(cat /run/pihole-FTL.port 2> /dev/null)
|
ftl_port=$(cat /run/pihole-FTL.port 2> /dev/null)
|
||||||
if [[ -n "$ftl_port" ]]; then
|
if [[ -n "$ftl_port" ]]; then
|
||||||
# Open connection to FTL
|
# Open connection to FTL
|
||||||
@ -20,12 +21,13 @@ pihole-FTL() {
|
|||||||
|
|
||||||
# Test if connection is open
|
# Test if connection is open
|
||||||
if { "true" >&3; } 2> /dev/null; then
|
if { "true" >&3; } 2> /dev/null; then
|
||||||
# Send command to FTL
|
# Send command to FTL and ask to quit when finished
|
||||||
echo -e ">$1" >&3
|
echo -e ">$1 >quit" >&3
|
||||||
|
|
||||||
# Read input
|
# Read input until we received an empty string and the connection is
|
||||||
|
# closed
|
||||||
read -r -t 1 LINE <&3
|
read -r -t 1 LINE <&3
|
||||||
until [[ ! $? ]] || [[ "$LINE" == *"EOM"* ]]; do
|
until [[ -z "${LINE}" ]] && [[ ! -t 3 ]]; do
|
||||||
echo "$LINE" >&1
|
echo "$LINE" >&1
|
||||||
read -r -t 1 LINE <&3
|
read -r -t 1 LINE <&3
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user