Try a second time

This commit is contained in:
Bob Mottram 2016-01-07 09:53:38 +00:00
parent 2352457d84
commit b9a5eb54f7
1 changed files with 15 additions and 1 deletions

View File

@ -1265,14 +1265,28 @@ function set_default_onion_domains {
function wait_for_onion_service { function wait_for_onion_service {
onion_service_name="$1" onion_service_name="$1"
sleep_ctr=0 sleep_ctr=0
while [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; do while [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; do
sleep 1 sleep 1
sleep_ctr=$((sleep_ctr + 1)) sleep_ctr=$((sleep_ctr + 1))
if [ $sleep_ctr -gt 20 ]; then if [ $sleep_ctr -gt 10 ]; then
break break
fi fi
done 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 { function add_onion_service {