From 59206a53a272bc8257bc740c9dbc84b545357f5c Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 8 Dec 2021 16:10:49 +0100 Subject: gkleen@sif: ssh proxy: less pid magic --- accounts/gkleen@sif/systemd.nix | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index de28895e..e6133896 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix @@ -22,20 +22,15 @@ let ( exec -a "''${cmd[1]}" -- ''${cmd} ) & pid=$! - ${pkgs.systemd}/bin/systemd-notify --pid="''${pid}" - check_pid() { - ${pkgs.lsof}/bin/lsof -Pi @localhost:"''${port}" -sTCP:LISTEN -t - } - - while ! check_pid; do + newpid="" + while ! newpid=$(${pkgs.lsof}/bin/lsof -Pi @localhost:"''${port}" -sTCP:LISTEN -t); do ${pkgs.coreutils}/bin/sleep 0.1 done - ${pkgs.systemd}/bin/systemd-notify --pid=$(check_pid) ${pkgs.systemd}/bin/systemd-notify --ready - wait "''${pid}" + wait "''${pid}" "''${newpid}" ''; in { services = { -- cgit v1.2.3