Created
December 29, 2018 06:12
-
-
Save AnotherDroog/d6efd53bcdba1efca0622c265a690105 to your computer and use it in GitHub Desktop.
lnd unlock script
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
[Unit] | |
Description=LND Lightning Daemon | |
Requires=bitcoind.service | |
After=bitcoind.service | |
[Service] | |
ExecStart=/usr/local/bin/lnd | |
ExecStartPost=+/etc/lnd/unlock | |
User=ln | |
Group=ln | |
Type=simple | |
KillMode=process | |
TimeoutSec=180 | |
Restart=always | |
RestartSec=10 | |
[Install] | |
WantedBy=multi-user.target |
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
#located at /etc/lnd/pwd | |
<place-password-here> |
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
#located at /etc/lnd/unlock | |
#!/bin/sh | |
/bin/sleep 5s | |
LN_ROOT=/home/lnd/.lnd | |
curl -s \ | |
-H "Grpc-Metadata-macaroon: $(xxd -ps -u -c 1000 ${LN_ROOT}/data/chain/bitcoin/mainnet/admin.macaroon)" \ | |
--cacert ${LN_ROOT}/tls.cert \ | |
-d "{\"wallet_password\": \"$(cat /etc/lnd/pwd | tr -d '\n' | base64 -w0)\"}" \ | |
https://localhost:8080/v1/unlockwallet > /dev/null 2>&1 | |
echo "$? $(date)" >> /etc/lnd/unlocks.log | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment