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

This commit is contained in:
Sandro
2024-11-06 01:16:43 +01:00
committed by GitHub
@@ -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";
};
};