From 0e86c3f5417bc6e009c2ea8a153eb025dfbb9946 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 11 Jun 2017 18:49:54 +0100 Subject: [PATCH] Waiting for onions --- src/freedombone-utils-onion | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/freedombone-utils-onion b/src/freedombone-utils-onion index c148cd60..2a6b98ab 100755 --- a/src/freedombone-utils-onion +++ b/src/freedombone-utils-onion @@ -56,10 +56,20 @@ function wait_for_onion_service_base { onion_service_name="$1" sleep_ctr=0 - while [ ! -f ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname ]; do + onion_site_domain='' + while [ ${#onion_site_domain} -lt 2 ]; do + if [ -f ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname ]; then + onion_site_domain=$(cat ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname) + fi + + if [ ${#onion_site_domain} -gt 1 ]; then + break + fi + sleep 1 + sleep_ctr=$((sleep_ctr + 1)) - if [ $sleep_ctr -gt 10 ]; then + if [ $sleep_ctr -gt 15 ]; then break fi done