From 6f2a55d63ca9b4daf70a22e31285ced720697e0c Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Wed, 27 Nov 2019 14:04:44 +0100 Subject: [PATCH] lnd: wait until RPC port is open --- modules/lnd.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/lnd.nix b/modules/lnd.nix index 9c074ba..19ab45f 100644 --- a/modules/lnd.nix +++ b/modules/lnd.nix @@ -137,6 +137,11 @@ in { -d "{\"wallet_password\": \"$(cat /secrets/lnd-wallet-password | tr -d '\n' | base64 -w0)\"}" \ https://127.0.0.1:8080/v1/unlockwallet fi + + # Wait until the RPC port is open + while ! { exec 3>/dev/tcp/127.0.0.1/${toString cfg.rpcPort}; } &>/dev/null; do + sleep 0.1 + done ''; }; };