gluon-mesh-babel: exit with error if unable to connect to babeld

This commit is contained in:
Christof Schulze 2018-11-22 23:51:54 +01:00
parent 89b7612fdb
commit e5b238e04a

View File

@ -22,11 +22,15 @@ start_service() {
echotobabel() { echotobabel() {
local count=0 local count=0
local line="$1" local line="$1"
local maxretries=10
while ! (echo -e "$line" | busybox nc ::1 "$PORT" >/dev/null 2>&1) while ! (echo -e "$line" | busybox nc ::1 "$PORT" >/dev/null 2>&1)
do do
sleep 1 sleep 1
echo retrying to connect to babeld in PID $$, waited ${count}s >&2 echo retrying to connect to babeld in PID $$, waited ${count}s >&2
count=$((count+1)) count=$((count+1))
if [ $count -gt $maxretries ]; then
return 1
fi
done done
return 0 return 0
} }