I got a simple systemd service to ensure im connected to a VPN, before another systemd service proceeds to start (the other systemd service, Requires this one). The VPN service looks roughly as follows
[Unit]Description=Establish connection to VPN[Service]ExecStart=/usr/bin/openvpn --config /etc/openvpn/ipvanish/ipvanish-UK-London-lon-a42.ovpn --ca /etc/openvpn/ipvanish/ca.ipvanish.com.crt --auth-user-pass /pathtopwd/fileExecStartPost=sleep 2Now, the last line is annoying me a little bit. Basically, I placed in it there, to ensure that the VPN is up and running before other systemd jobs which Requires this service proceeds to start.
It works, but it feels rather inelegant. Could anybody suggest a cleaner way to ensure that the VPN is actually up and running, before other systemd services, which depends on this service will start up?