Skip to content

Commit 4554d61

Browse files
authored
Merge pull request #1898 from pi-hole/wait-for
Use FTL's build-in wait-for command for checking the logs
2 parents 5ff925b + 53baec4 commit 4554d61

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/start.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,13 @@ start() {
7575
sleep 0.5
7676
done
7777

78-
# Wait until the FTL log contains the "FTL started" message before continuing
79-
while ! grep -q '########## FTL started' /var/log/pihole/FTL.log; do
80-
sleep 0.5
81-
done
78+
# Wait until the FTL log contains the "FTL started" message before continuing, timeout after 10 seconds
79+
# exit if we do not find it
80+
pihole-FTL wait-for '########## FTL started' /var/log/pihole/FTL.log 10 "0 > /dev/null"
81+
if [ $? -ne 0 ]; then
82+
echo " [✗] FTL did not start - stopping container"
83+
exit 1
84+
fi
8285

8386
pihole updatechecker
8487
local versionsOutput

test/tests/test_general.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_pihole_ftl_architecture(docker):
5050

5151

5252
# Wait 5 seconds for startup, then kill the start.sh script
53-
# Finally, grep the FTL log to see if it has been shut down cleanly
53+
# Finally, check the FTL log to see if it has been shut down cleanly
5454
def test_pihole_ftl_clean_shutdown(docker):
5555
func = docker.run(
5656
"""

0 commit comments

Comments
 (0)