Hi,
Been looking in to this again, since dill posted. I’m currently testing a solution, but my vpn is pretty solid; but simulating a drop; it worked. You could try this:
/etc/systemd/system/openvpn-watchdog.timer:
[Unit]
Description=OpenVPN Watchdog timer
[Timer]
OnCalendar=*:0/15
[Install]
WantedBy=timers.target
/etc/systemd/system/openvpn-watchdog.service:
[Unit]
Description=OpenVPN Watchdog service
ConditionPathExists=!/proc/sys/net/ipv4/conf/tun0
[Service]
ExecStart=/bin/systemctl restart openvpn@pia_Ireland
[Install]
WantedBy=multi-user.target
sudo systemctl start openvpn-watchdog.timer
sudo systemctl enable openvpn-watchdog.timer
Please take notice we are starting and enabling the timer here, not the service; won’t work if openvpn-watchdog.service is enabled.
The timer is just scedule for the watch dog service to run every 15 min. The server checks if /proc/sys/net/ipv4/conf/tun0 exists, if it does then the watch dog service does nothing and process is repeated in 15 min. If /proc/sys/net/ipv4/conf/tun0 doesn’t exist, it means the tunnel has dropped and restating the openvpn@ service should bring the vpn tunnel back up.
Based on this:
https://bbs.archlinux.org/viewtopic.php?id=234546
Thanks Tom.