1
0

OpenVPN keep-alive service

This commit is contained in:
dump_stack() 2022-05-11 14:23:27 +00:00
parent 091b933921
commit 17bbf35907
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -100,6 +100,18 @@ in {
wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ]; wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
script = "${pkgs.systemd}/bin/systemctl try-restart openvpn-vpn.service"; script = "${pkgs.systemd}/bin/systemctl try-restart openvpn-vpn.service";
}; };
"openvpn-keep-alive" = {
description = "Make sure OpenVPN connection is alive";
after = [ "openvpn-vpn.service" ];
wantedBy = [ "openvpn-vpn.service" ];
script = ''
while [ 1 ]; do
sleep 10s
timeout 10s ${pkgs.iputils}/bin/ping -c1 1.1.1.1 >/dev/null 2>&1 || \
${pkgs.systemd}/bin/systemctl try-restart openvpn-vpn.service
done
'';
};
}; };
}; };
} }