Skip to content

Commit

Permalink
raspiblitz#100 beginning of set lnd port script
Browse files Browse the repository at this point in the history
  • Loading branch information
rootzoll committed Feb 23, 2019
1 parent becad8e commit 5d8d5e9
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions home.admin/config.scripts/lnd.setport.sh
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"

0 comments on commit 5d8d5e9

Please sign in to comment.