diff options
Diffstat (limited to 'accounts/gkleen@sif')
-rw-r--r-- | accounts/gkleen@sif/systemd.nix | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index e6133896..c8eda9d0 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix | |||
@@ -24,7 +24,14 @@ let | |||
24 | pid=$! | 24 | pid=$! |
25 | 25 | ||
26 | newpid="" | 26 | newpid="" |
27 | i=100 | ||
27 | while ! newpid=$(${pkgs.lsof}/bin/lsof -Pi @localhost:"''${port}" -sTCP:LISTEN -t); do | 28 | while ! newpid=$(${pkgs.lsof}/bin/lsof -Pi @localhost:"''${port}" -sTCP:LISTEN -t); do |
29 | if ! kill -0 "''${pid}"; then | ||
30 | wait "''${pid}" | ||
31 | exit $? | ||
32 | fi | ||
33 | [[ "''${i}" -gt 0 ]] || exit 1 | ||
34 | i=$((''${i} - 1)) | ||
28 | ${pkgs.coreutils}/bin/sleep 0.1 | 35 | ${pkgs.coreutils}/bin/sleep 0.1 |
29 | done | 36 | done |
30 | 37 | ||
@@ -73,11 +80,14 @@ in { | |||
73 | NotifyAccess = "all"; | 80 | NotifyAccess = "all"; |
74 | WorkingDirectory = "~"; | 81 | WorkingDirectory = "~"; |
75 | Restart = "always"; | 82 | Restart = "always"; |
83 | RestartSec = "2s"; | ||
76 | ExecStart = "${autossh-socks-script} \"%I\""; | 84 | ExecStart = "${autossh-socks-script} \"%I\""; |
77 | Environment = [ "SSHPASS_SECRET=gkleen@mathw0g.math.lmu.de" ]; | 85 | Environment = [ "SSHPASS_SECRET=gkleen@mathw0g.math.lmu.de" ]; |
78 | }; | 86 | }; |
79 | Unit = { | 87 | Unit = { |
80 | StopWhenUnneeded = true; | 88 | StopWhenUnneeded = true; |
89 | StartLimitInterval = "2s"; | ||
90 | StartLimitBurst = 5; | ||
81 | }; | 91 | }; |
82 | }; | 92 | }; |
83 | "proxy-to-autossh-socks@8118" = { | 93 | "proxy-to-autossh-socks@8118" = { |