From 647f6c94eae696bb7d468a80ff8616f0c9b45919 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Wed, 24 Sep 2025 10:04:13 +0200 Subject: [PATCH 1/3] Use FTL's build-in wait-for command for checking the logs Signed-off-by: yubiuser --- src/start.sh | 7 +++---- test/tests/test_general.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/start.sh b/src/start.sh index 3361a53..2a5e68b 100644 --- a/src/start.sh +++ b/src/start.sh @@ -75,10 +75,9 @@ start() { sleep 0.5 done - # Wait until the FTL log contains the "FTL started" message before continuing - while ! grep -q '########## FTL started' /var/log/pihole/FTL.log; do - sleep 0.5 - done + # Wait until the FTL log contains the "FTL started" message before continuing, timeout after 10 seconds + logsize_before=$(stat -c%s /var/log/pihole/FTL.log) + pihole-FTL wait-for '########## FTL started' /var/log/pihole/FTL.log 10 "${logsize_before}" > /dev/null pihole updatechecker local versionsOutput diff --git a/test/tests/test_general.py b/test/tests/test_general.py index d5fef0a..70b9ab7 100644 --- a/test/tests/test_general.py +++ b/test/tests/test_general.py @@ -50,7 +50,7 @@ def test_pihole_ftl_architecture(docker): # Wait 5 seconds for startup, then kill the start.sh script -# Finally, grep the FTL log to see if it has been shut down cleanly +# Finally, check the FTL log to see if it has been shut down cleanly def test_pihole_ftl_clean_shutdown(docker): func = docker.run( """ From f21d6e0a6995fa9dc3603af30332aad23a86e5f1 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Sat, 27 Sep 2025 11:45:51 +0200 Subject: [PATCH 2/3] Exit if FTL did not start Signed-off-by: yubiuser --- src/start.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/start.sh b/src/start.sh index 2a5e68b..c182909 100644 --- a/src/start.sh +++ b/src/start.sh @@ -75,9 +75,13 @@ start() { sleep 0.5 done - # Wait until the FTL log contains the "FTL started" message before continuing, timeout after 10 seconds - logsize_before=$(stat -c%s /var/log/pihole/FTL.log) - pihole-FTL wait-for '########## FTL started' /var/log/pihole/FTL.log 10 "${logsize_before}" > /dev/null + # Wait until the FTL log contains the "FTL started" message before continuing, timeout after 10 seconds + # exit if we do not find it + pihole-FTL wait-for '########## FTL started' /var/log/pihole/FTL.log 10 "0 > /dev/null" + if [ $? -ne 0 ]; then + echo " [✗] FTL did not start" + exit 1 + fi pihole updatechecker local versionsOutput From 53baec4b81c9ad4f9761b101d796522ce32eb87e Mon Sep 17 00:00:00 2001 From: yubiuser Date: Sat, 27 Sep 2025 12:33:43 +0200 Subject: [PATCH 3/3] Improve wording Co-authored-by: Adam Warner Signed-off-by: yubiuser --- src/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/start.sh b/src/start.sh index c182909..9cee84e 100644 --- a/src/start.sh +++ b/src/start.sh @@ -79,7 +79,7 @@ start() { # exit if we do not find it pihole-FTL wait-for '########## FTL started' /var/log/pihole/FTL.log 10 "0 > /dev/null" if [ $? -ne 0 ]; then - echo " [✗] FTL did not start" + echo " [✗] FTL did not start - stopping container" exit 1 fi