raspiblitz/home.admin/assets/getpublicip.sh

15 lines
552 B
Bash
Raw Normal View History

2018-08-21 03:41:46 +02:00
#!/bin/bash
# RaspiBolt LND Mainnet: script to get public ip address
# /usr/local/bin/getpublicip.sh
echo 'getpublicip.sh started, writing public IP address every 10 minutes into /run/publicip'
while [ 0 ];
do
2018-08-22 12:00:41 +02:00
# when TOR is installed the fixed onion address is already in /run/publicip
2018-08-22 11:34:15 +02:00
torExists=$(sudo ls /mnt/hdd/tor/web80/hostname 2>/dev/null | grep hostname -c)
2018-08-22 12:00:41 +02:00
if [ ${torExists} -eq 0 ]; then
2018-08-21 03:41:46 +02:00
# get public IP
printf "PUBLICIP=$(curl -vv ipinfo.io/ip 2> /run/publicip.log)\n" > /run/publicip;
fi
sleep 600
done;