From b9a5eb54f7dd32914c03c56d55bcf2c168d160fa Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 7 Jan 2016 09:53:38 +0000 Subject: [PATCH] Try a second time --- src/freedombone | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/freedombone b/src/freedombone index af2bb0a8..a0603b4d 100755 --- a/src/freedombone +++ b/src/freedombone @@ -1265,14 +1265,28 @@ function set_default_onion_domains { function wait_for_onion_service { onion_service_name="$1" + sleep_ctr=0 while [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; do sleep 1 sleep_ctr=$((sleep_ctr + 1)) - if [ $sleep_ctr -gt 20 ]; then + if [ $sleep_ctr -gt 10 ]; then break fi done + + if [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then + # restart and try a second time + systemctl restart tor + sleep_ctr=0 + while [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; do + sleep 1 + sleep_ctr=$((sleep_ctr + 1)) + if [ $sleep_ctr -gt 10 ]; then + break + fi + done + fi } function add_onion_service {