Unverified Commit a633b5fb authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

OpenVPN: don't fail to restart stopped units (#345993)

parents 61d50acf 2a15702b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -73,8 +73,9 @@ let
    openvpn-restart = {
      wantedBy = [ "sleep.target" ];
      path = [ pkgs.procps ];
      script = "pkill --signal SIGHUP --exact openvpn";
      #SIGHUP makes openvpn process to self-exit and then it got restarted by systemd because of Restart=always
      script = let
        unitNames = map (n: "openvpn-${n}.service") (builtins.attrNames cfg.servers);
      in "systemctl try-restart ${lib.escapeShellArgs unitNames}";
      description = "Sends a signal to OpenVPN process to trigger a restart after return from sleep";
    };
  };