Browse Source

remove waiting loops from tor

dev
rootzoll 6 years ago
parent
commit
c44457a4bf
  1. 82
      home.admin/config.scripts/internet.tor.sh

82
home.admin/config.scripts/internet.tor.sh

@ -145,23 +145,23 @@ EOF
echo "*** Activating TOR system service ***" echo "*** Activating TOR system service ***"
echo "ReadWriteDirectories=-/mnt/hdd/tor" | sudo tee -a /lib/systemd/system/tor@default.service echo "ReadWriteDirectories=-/mnt/hdd/tor" | sudo tee -a /lib/systemd/system/tor@default.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl restart tor@default sudo systemctl enable tor@default
echo "" echo ""
echo "*** Waiting for TOR to boostrap ***" #echo "*** Waiting for TOR to boostrap ***"
torIsBootstrapped=0 #torIsBootstrapped=0
while [ ${torIsBootstrapped} -eq 0 ] #while [ ${torIsBootstrapped} -eq 0 ]
do #do
echo "--- Checking 1 ---" # echo "--- Checking 1 ---"
date +%s # date +%s
sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped" | tail -n 10 # sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped" | tail -n 10
torIsBootstrapped=$(sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped 100" -c) # torIsBootstrapped=$(sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped 100" -c)
echo "torIsBootstrapped(${torIsBootstrapped})" # echo "torIsBootstrapped(${torIsBootstrapped})"
echo "If this takes too long --> CTRL+c, reboot and check manually" # echo "If this takes too long --> CTRL+c, reboot and check manually"
sleep 5 # sleep 5
done #done
echo "OK - Tor Bootstrap is ready" #echo "OK - Tor Bootstrap is ready"
echo "" #echo ""
echo "*** Changing ${network} Config ***" echo "*** Changing ${network} Config ***"
networkIsTor=$(sudo cat /home/bitcoin/.${network}/${network}.conf | grep 'onlynet=onion' -c) networkIsTor=$(sudo cat /home/bitcoin/.${network}/${network}.conf | grep 'onlynet=onion' -c)
@ -186,33 +186,33 @@ EOF
echo "Chain network already configured for TOR" echo "Chain network already configured for TOR"
fi fi
echo "*** ${network} re-init - Waiting for Onion Address ***" #echo "*** ${network} re-init - Waiting for Onion Address ***"
# restarting bitcoind to start with tor and generare onion.address # restarting bitcoind to start with tor and generare onion.address
echo "restarting ${network}d ..." #echo "restarting ${network}d ..."
sudo systemctl restart ${network}d #sudo systemctl restart ${network}d
sleep 8 #sleep 8
onionAddress="" #onionAddress=""
while [ ${#onionAddress} -eq 0 ] #while [ ${#onionAddress} -eq 0 ]
do #do
echo "--- Checking 2 ---" # echo "--- Checking 2 ---"
date +%s # date +%s
testNetAdd="" # testNetAdd=""
if [ "${chain}" = "test" ];then # if [ "${chain}" = "test" ];then
testNetAdd="/testnet3" # testNetAdd="/testnet3"
fi # fi
sudo cat /mnt/hdd/${network}${testNetAdd}/debug.log 2>/dev/null | grep "tor" | tail -n 10 # sudo cat /mnt/hdd/${network}${testNetAdd}/debug.log 2>/dev/null | grep "tor" | tail -n 10
onionAddress=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"address"' | cut -d '"' -f4) # onionAddress=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"address"' | cut -d '"' -f4)
echo "Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually" # echo "Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually"
sleep 5 # sleep 5
done #done
onionPort=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"port"' | tr -dc '0-9') #onionPort=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"port"' | tr -dc '0-9')
echo "Your Chain Network Onion Address is: ${onionAddress}:${onionPort}" #echo "Your Chain Network Onion Address is: ${onionAddress}:${onionPort}"
echo "" #echo ""
echo "*** Setting your Onion Address ***" #echo "*** Setting your Onion Address ***"
onionLND=$(sudo cat /mnt/hdd/tor/lnd9735/hostname) #onionLND=$(sudo cat /mnt/hdd/tor/lnd9735/hostname)
echo "Your Lightning Tor Onion Address is: ${onionLND}:9735" #echo "Your Lightning Tor Onion Address is: ${onionLND}:9735"
echo "" #echo ""
# ACTIVATE LND OVER TOR # ACTIVATE LND OVER TOR
echo "*** Putting LND behind TOR ***" echo "*** Putting LND behind TOR ***"

Loading…
Cancel
Save