#1000 added keysend config script

This commit is contained in:
rootzoll 2020-03-21 23:18:19 -07:00
parent 158e4b6665
commit 2dd3cf44c8
4 changed files with 43 additions and 7 deletions

View file

@ -11,7 +11,7 @@ After=bitcoind.service
[Service]
EnvironmentFile=/mnt/hdd/raspiblitz.conf
ExecStartPre=-/home/admin/config.scripts/blitz.systemd.sh log lightning STARTED
ExecStart=/usr/local/bin/lnd --externalip=${publicIP}:${lndPort}
ExecStart=/usr/local/bin/lnd --externalip=${publicIP}:${lndPort} ${lndExtraParameter}
PIDFile=/home/bitcoin/.lnd/lnd.pid
User=bitcoin
Group=bitcoin

View file

@ -154,7 +154,7 @@ activateLndOverTOR()
sudo systemctl disable lnd 2>/dev/null
echo "editing /etc/systemd/system/lnd.service"
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --tor\.active --tor\.streamisolation --tor\.v3 --listen=127\.0\.0\.1\:9735/g" /etc/systemd/system/lnd.service
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --tor\.active --tor\.streamisolation --tor\.v3 --listen=127\.0\.0\.1\:9735 \${lndExtraParameter}/g" /etc/systemd/system/lnd.service
echo "Enable LND again"
sudo systemctl enable lnd
@ -409,7 +409,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "*** Removing TOR from LND ***"
sudo systemctl disable lnd
echo "editing /etc/systemd/system/lnd.service"
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:\${lndPort}/g" /etc/systemd/system/lnd.service
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:\${lndPort} \${lndExtraParameter}/g" /etc/systemd/system/lnd.service
sudo systemctl enable lnd
echo "OK"

View file

@ -0,0 +1,40 @@
#!/bin/bash
# based on: https://github.com/rootzoll/raspiblitz/issues/1000
if [ $# -eq 0 ]; then
echo "activate/deactivate LND keysend feature"
echo "lnd.keysend.sh [on|off|status]"
exit 1
fi
source /mnt/hdd/raspiblitz.conf
parameter=$1
if [ "${parameter}" == "on" ]; then
# store to raspiblitz config (delete old line / add new)
sudo sed -i '/lndExtraParameter=.*/d' /mnt/hdd/raspiblitz.conf
echo "lndExtraParameter='--accept-keysend'" >> /mnt/hdd/raspiblitz.conf
echo "# OK - keysend feature is switched ON"
echo "# LND reload needed: sudo systemctl restart lnd"
elif [ "${parameter}" == "off" ]; then
# just remove the parameter from the config file
sudo sed -i '/lndExtraParameter=.*/d' /mnt/hdd/raspiblitz.conf
echo "# OK - keysend feature is switched OFF"
echo "# LND reload needed: sudo systemctl restart lnd"
elif [ "${parameter}" == "status" ]; then
keysendOn=$(echo "${lndExtraParameter}" | grep -c '--accept-keysend')
keysendRunning=$(sudo systemctl status lnd | grep -c "accept-keysend")
echo "keysendOn=${keysendOn}"
echo "keysendRunning=${keysendRunning}"
else
echo "err='unknown parameter'"
fi

View file

@ -73,10 +73,6 @@ else
sudo sed -i "s/^lndPort=.*/lndPort=${portnumber}/g" /mnt/hdd/raspiblitz.conf
fi
# editing service file
echo "editing /etc/systemd/system/lnd.service"
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:\${lndPort}/g" /etc/systemd/system/lnd.service
# enable service again
echo "enable service again"
sudo systemctl enable lnd