Wait for onion service as its own function
This commit is contained in:
parent
56dec16be1
commit
2352457d84
|
@ -1263,6 +1263,18 @@ function set_default_onion_domains {
|
|||
fi
|
||||
}
|
||||
|
||||
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
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function add_onion_service {
|
||||
onion_service_name="$1"
|
||||
onion_service_port_from=$2
|
||||
|
@ -1278,16 +1290,7 @@ function add_onion_service {
|
|||
fi
|
||||
|
||||
systemctl restart tor
|
||||
|
||||
# wait for the new service to appear
|
||||
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
|
||||
wait_for_onion_service ${onion_service_name}
|
||||
|
||||
if [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
||||
echo $"${onion_service_name} onion site hostname not found"
|
||||
|
@ -4275,16 +4278,7 @@ function configure_email {
|
|||
fi
|
||||
|
||||
systemctl restart tor
|
||||
|
||||
# wait for the new service to appear
|
||||
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
|
||||
wait_for_onion_service ${onion_service_name}
|
||||
|
||||
if [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
||||
echo $"${onion_service_name} onion site hostname not found"
|
||||
|
@ -6720,15 +6714,7 @@ quit" > $INSTALL_DIR/batch.sql
|
|||
fi
|
||||
|
||||
systemctl restart tor
|
||||
|
||||
sleep_ctr=0
|
||||
while [ ! -f /var/lib/tor/hidden_service_gogs/hostname ]; do
|
||||
sleep 1
|
||||
sleep_ctr=$((sleep_ctr + 1))
|
||||
if [ $sleep_ctr -gt 10 ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
wait_for_onion_service 'gogs'
|
||||
|
||||
GIT_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_gogs/hostname)
|
||||
|
||||
|
@ -7134,15 +7120,7 @@ function install_xmpp {
|
|||
fi
|
||||
|
||||
systemctl restart tor
|
||||
|
||||
sleep_ctr=0
|
||||
while [ ! -f /var/lib/tor/hidden_service_xmpp/hostname ]; do
|
||||
sleep 1
|
||||
sleep_ctr=$((sleep_ctr + 1))
|
||||
if [ $sleep_ctr -gt 10 ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
wait_for_onion_service 'xmpp'
|
||||
|
||||
if [ ! -f /var/lib/tor/hidden_service_xmpp/hostname ]; then
|
||||
echo $'XMPP onion site hostname not found'
|
||||
|
|
Loading…
Reference in New Issue