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
|
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 {
|
function add_onion_service {
|
||||||
onion_service_name="$1"
|
onion_service_name="$1"
|
||||||
onion_service_port_from=$2
|
onion_service_port_from=$2
|
||||||
|
@ -1278,16 +1290,7 @@ function add_onion_service {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl restart tor
|
systemctl restart tor
|
||||||
|
wait_for_onion_service ${onion_service_name}
|
||||||
# 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
|
|
||||||
|
|
||||||
if [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
if [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
||||||
echo $"${onion_service_name} onion site hostname not found"
|
echo $"${onion_service_name} onion site hostname not found"
|
||||||
|
@ -4275,16 +4278,7 @@ function configure_email {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl restart tor
|
systemctl restart tor
|
||||||
|
wait_for_onion_service ${onion_service_name}
|
||||||
# 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
|
|
||||||
|
|
||||||
if [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
if [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
||||||
echo $"${onion_service_name} onion site hostname not found"
|
echo $"${onion_service_name} onion site hostname not found"
|
||||||
|
@ -6720,15 +6714,7 @@ quit" > $INSTALL_DIR/batch.sql
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl restart tor
|
systemctl restart tor
|
||||||
|
wait_for_onion_service 'gogs'
|
||||||
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
|
|
||||||
|
|
||||||
GIT_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_gogs/hostname)
|
GIT_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_gogs/hostname)
|
||||||
|
|
||||||
|
@ -7134,15 +7120,7 @@ function install_xmpp {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl restart tor
|
systemctl restart tor
|
||||||
|
wait_for_onion_service 'xmpp'
|
||||||
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
|
|
||||||
|
|
||||||
if [ ! -f /var/lib/tor/hidden_service_xmpp/hostname ]; then
|
if [ ! -f /var/lib/tor/hidden_service_xmpp/hostname ]; then
|
||||||
echo $'XMPP onion site hostname not found'
|
echo $'XMPP onion site hostname not found'
|
||||||
|
|
Loading…
Reference in New Issue