I use the following systemd service to restart openvpn after a suspend:
systemd.services.openvpn-reconnect = {
enable = true;
description = "Restart OpenVPN after suspend";
script = "${pkgs.procps}/bin/pkill --signal SIGHUP --exact openvpn";
wantedBy = [ "sleep.target" ];
};
It works great.
However, if I put my laptop into airplane mode by hitting the airplane mode button (which I presume turns off all radios), when I hit the airplane mode button again to turn the radios back on, I need to manually restart openvpn using the above command.
Is there a way to have the above systemd service run after re-enabling the radios? Is this the correct approach?