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
1 changed files with 4 additions and 0 deletions

View File

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