I need to bring up an OpenVPN connection on the condition that a site is not reachable (on numerous devices spread over several heterogeneous networks). I did not find any such feature in OpenVPN directly so I ended up with a few possibilities:
within
/etc/rc.local
: make a connectivity check andsystemctl start openvpn
- problem:
/etc/rc.local
is a systemv feature, not systemd (where it is optional and therefore there are probably better ways)
- problem:
create a
/etc/systemd/system/checkconnect.service
which wouldExec
a script with the same actions as abovesystemd
provides a set of conditions on the start of a service but there is nothing related to networking.
Is there a standard way to conditionally start OpenVPN?