summaryrefslogtreecommitdiff
path: root/accounts
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2021-12-08 16:10:49 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2021-12-08 16:10:49 +0100
commit59206a53a272bc8257bc740c9dbc84b545357f5c (patch)
tree6bdcdb96a8237ecc8e8b232a44a550e39f76e288 /accounts
parenta7029ec67b4b496f4cd1c3805b2adcdd1889e11b (diff)
downloadnixos-59206a53a272bc8257bc740c9dbc84b545357f5c.tar
nixos-59206a53a272bc8257bc740c9dbc84b545357f5c.tar.gz
nixos-59206a53a272bc8257bc740c9dbc84b545357f5c.tar.bz2
nixos-59206a53a272bc8257bc740c9dbc84b545357f5c.tar.xz
nixos-59206a53a272bc8257bc740c9dbc84b545357f5c.zip
gkleen@sif: ssh proxy: less pid magic
Diffstat (limited to 'accounts')
-rw-r--r--accounts/gkleen@sif/systemd.nix11
1 files 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
22 22
23 ( exec -a "''${cmd[1]}" -- ''${cmd} ) & 23 ( exec -a "''${cmd[1]}" -- ''${cmd} ) &
24 pid=$! 24 pid=$!
25 ${pkgs.systemd}/bin/systemd-notify --pid="''${pid}"
26 25
27 check_pid() { 26 newpid=""
28 ${pkgs.lsof}/bin/lsof -Pi @localhost:"''${port}" -sTCP:LISTEN -t 27 while ! newpid=$(${pkgs.lsof}/bin/lsof -Pi @localhost:"''${port}" -sTCP:LISTEN -t); do
29 }
30
31 while ! check_pid; do
32 ${pkgs.coreutils}/bin/sleep 0.1 28 ${pkgs.coreutils}/bin/sleep 0.1
33 done 29 done
34 30
35 ${pkgs.systemd}/bin/systemd-notify --pid=$(check_pid)
36 ${pkgs.systemd}/bin/systemd-notify --ready 31 ${pkgs.systemd}/bin/systemd-notify --ready
37 32
38 wait "''${pid}" 33 wait "''${pid}" "''${newpid}"
39 ''; 34 '';
40in { 35in {
41 services = { 36 services = {