fix nodeinfo.sh

This commit is contained in:
Jonas Nick 2018-11-29 00:30:12 +00:00
parent 95c706b1b0
commit c61c21e2e1
2 changed files with 8 additions and 11 deletions

View File

@ -60,13 +60,14 @@ in {
after = [ "clightning.service" "tor.service" ]; after = [ "clightning.service" "tor.service" ];
path = [ pkgs.clightning pkgs.jq pkgs.sudo ]; path = [ pkgs.clightning pkgs.jq pkgs.sudo ];
serviceConfig = { serviceConfig = {
ExecStart="${pkgs.bash}/bin/bash ${pkgs.nodeinfo}/bin/nodeinfo"; ExecStart="${pkgs.bash}/bin/bash ${pkgs.nodeinfo}/bin/nodeinfo > /var/lib/nodeinfo.nix";
User = "root"; User = "root";
Type = "simple"; Type = "simple";
RemainAfterExit="yes"; RemainAfterExit="yes";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = "10s"; RestartSec = "10s";
}; };
}; };
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.

View File

@ -1,15 +1,11 @@
set -e set -e
set -o pipefail set -o pipefail
OUTFILE=/var/lib/nodeinfo.nix printenv
BITCOIND_ONION=$(cat /var/lib/tor/onion/bitcoind/hostname) BITCOIND_ONION=$(cat /var/lib/tor/onion/bitcoind/hostname)
CLIGHTNING_ID=$(sudo -u clightning lightning-cli getinfo | jq -r '.id') CLIGHTNING_ID=$(sudo -u clightning lightning-cli --lightning-dir=/var/lib/clightning getinfo | jq -r '.id')
rm -f $OUTFILE echo \{
{ echo " bitcoind_onion = \"$BITCOIND_ONION\";"
echo \{ echo " clightning_id = \"$CLIGHTNING_ID\";"
echo " bitcoind_onion = \"$BITCOIND_ONION\";" echo \}
echo " clightning_id = \"$CLIGHTNING_ID\";"
echo \}
} > $OUTFILE