From a7029ec67b4b496f4cd1c3805b2adcdd1889e11b Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 8 Dec 2021 16:01:16 +0100 Subject: gkleen@sif: ssh proxy: lsof --- accounts/gkleen@sif/systemd.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index eff9aa5e..de28895e 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix @@ -24,10 +24,15 @@ let pid=$! ${pkgs.systemd}/bin/systemd-notify --pid="''${pid}" - while ! ${pkgs.netcat-openbsd.nc}/bin/nc -z -v localhost ''${port}; do + check_pid() { + ${pkgs.lsof}/bin/lsof -Pi @localhost:"''${port}" -sTCP:LISTEN -t + } + + while ! check_pid; do ${pkgs.coreutils}/bin/sleep 0.1 done + ${pkgs.systemd}/bin/systemd-notify --pid=$(check_pid) ${pkgs.systemd}/bin/systemd-notify --ready wait "''${pid}" -- cgit v1.2.3