mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-11-18 09:57:17 +01:00
moving getpublic script to assets
This commit is contained in:
20
home.admin/assets/getpublicip.service
Normal file
20
home.admin/assets/getpublicip.service
Normal file
@@ -0,0 +1,20 @@
|
||||
# RaspiBolt LND Mainnet: systemd unit for getpublicip.sh script
|
||||
# /etc/systemd/system/getpublicip.service
|
||||
|
||||
[Unit]
|
||||
Description=getpublicip.sh: get public ip address from ipinfo.io
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Group=root
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/getpublicip.sh
|
||||
ExecStartPost=/bin/sleep 5
|
||||
Restart=always
|
||||
|
||||
RestartSec=600
|
||||
TimeoutSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
17
home.admin/assets/getpublicip.sh
Normal file
17
home.admin/assets/getpublicip.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/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
|
||||
torExists=$(sudo ls /mnt/hdd/tor/lnd9735/hostname 2>/dev/null | grep hostname -c)
|
||||
if [ ${torExists} -eq 1 ]; then
|
||||
# use tor onion address
|
||||
printf "PUBLICIP=$(sudo cat /mnt/hdd/tor/lnd9735/hostname)\n" > /run/publicip;
|
||||
else
|
||||
# get public IP
|
||||
printf "PUBLICIP=$(curl -vv ipinfo.io/ip 2> /run/publicip.log)\n" > /run/publicip;
|
||||
fi
|
||||
sleep 600
|
||||
done;
|
||||
Reference in New Issue
Block a user