forked from raspiblitz/raspiblitz
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
raspiblitz#100 beginning of set lnd port script
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
# based on: https://github.com/rootzoll/raspiblitz/issues/100#issuecomment-465997126 | ||
|
||
if [ $# -eq 0 ]; then | ||
echo "small config script set the port LND is running on" | ||
echo "lnd.setport.sh [portnumber]" | ||
exit 1 | ||
fi | ||
|
||
portnumber=$1 | ||
|
||
# check port number is bigger then zero | ||
if [ ${portnumber} -lt 1 ]; then | ||
echo "FAIL - portnumber(${portnumber}) not above 0" | ||
exit 1 | ||
fi | ||
|
||
# check port number is smaller than max | ||
if [ ${portnumber} -gt 65535 ]; then | ||
echo "FAIL - portnumber(${portnumber}) not below 65535" | ||
exit 1 | ||
fi | ||
|
||
# check lnd.conf exits | ||
lndConfExists=$(sudo ls /mnt/hdd/lnd/lnd.conf | grep -c 'lnd.conf') | ||
if [ ${lndConfExists} -eq 0 ]; then | ||
echo "FAIL - /mnt/hdd/lnd/lnd.conf not found" | ||
exit 1 | ||
fi | ||
|
||
echo "DEBUG EXIT" | ||
exit 0 | ||
|
||
# check if "listen=" exists in lnd config | ||
valueExists=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c 'nat=') | ||
if [ ${valueExists} -eq 0 ]; then | ||
echo "Adding autonat config defaults to /mnt/hdd/lnd/lnd.conf" | ||
sudo sed -i '$ a listen=0.0.0.0:9735' /mnt/hdd/lnd/lnd.conf | ||
fi | ||
|
||
# stop services | ||
echo "making sure services are not running" | ||
sudo systemctl stop lnd 2>/dev/null | ||
|
||
echo "needs reboot to activate new setting" |