More directly check for onion service
This commit is contained in:
parent
ba69e9fe10
commit
da059f8368
|
@ -170,7 +170,7 @@ function configure_email_onion {
|
||||||
function_check wait_for_onion_service
|
function_check wait_for_onion_service
|
||||||
wait_for_onion_service email
|
wait_for_onion_service email
|
||||||
|
|
||||||
if [[ $(onion_service_exists email) == "0" ]]; then
|
if [ ! -f /var/lib/tor/hidden_service_email/hostname ]; then
|
||||||
echo $"email onion site hostname not found"
|
echo $"email onion site hostname not found"
|
||||||
systemctl restart tor
|
systemctl restart tor
|
||||||
exit 782352
|
exit 782352
|
||||||
|
|
|
@ -50,21 +50,11 @@ function onion_update {
|
||||||
systemctl restart tor
|
systemctl restart tor
|
||||||
}
|
}
|
||||||
|
|
||||||
function onion_service_exists {
|
|
||||||
onion_service_name="$1"
|
|
||||||
|
|
||||||
if [ -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
|
||||||
echo -n "1"
|
|
||||||
else
|
|
||||||
echo -n "0"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function wait_for_onion_service_base {
|
function wait_for_onion_service_base {
|
||||||
onion_service_name="$1"
|
onion_service_name="$1"
|
||||||
|
|
||||||
sleep_ctr=0
|
sleep_ctr=0
|
||||||
while [[ $(onion_service_exists ${onion_service_name}) == "0" ]]; 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 10 ]; then
|
if [ $sleep_ctr -gt 10 ]; then
|
||||||
|
@ -78,7 +68,7 @@ function wait_for_onion_service {
|
||||||
|
|
||||||
wait_for_onion_service_base ${onion_service_name}
|
wait_for_onion_service_base ${onion_service_name}
|
||||||
|
|
||||||
if [[ $(onion_service_exists ${onion_service_name}) == "0" ]]; then
|
if [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
||||||
# try a second time
|
# try a second time
|
||||||
onion_update
|
onion_update
|
||||||
wait_for_onion_service_base ${onion_service_name}
|
wait_for_onion_service_base ${onion_service_name}
|
||||||
|
@ -123,8 +113,8 @@ function add_onion_service {
|
||||||
onion_service_port_to=$3
|
onion_service_port_to=$3
|
||||||
onion_stealth_name="$4"
|
onion_stealth_name="$4"
|
||||||
|
|
||||||
if [[ $(onion_service_exists ${onion_service_name}) == "1" ]]; then
|
if [ -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
||||||
cat /var/lib/tor/hidden_service_${onion_service_name}/hostname
|
echo $(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -145,7 +135,7 @@ function add_onion_service {
|
||||||
function_check wait_for_onion_service
|
function_check wait_for_onion_service
|
||||||
wait_for_onion_service ${onion_service_name}
|
wait_for_onion_service ${onion_service_name}
|
||||||
|
|
||||||
if [[ $(onion_service_exists ${onion_service_name}) == "0" ]]; 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"
|
||||||
exit 763624
|
exit 763624
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue