You are not logged in.
Hi!
I am trying to create a watchdog to restart the OpenVPN connection if it get dropped. Desided to user systemd timers for this and here what I got so far:
openvpn-watchdog.timer
[Unit]
Description=OpenVPN Watchdog timer
[Timer]
OnCalendar=*-*-* *:*:00
[Install]
WantedBy=timers.target
openvpn-watchdog.service
[Unit]
Description=OpenVPN Watchdog service
ConditionPathExists=!/proc/sys/net/ipv4/conf/tun0
[Service]
ExecStart=/bin/systemctl restart openvpn@VPN.service
[Install]
WantedBy=multi-user.target
Timer triggers the service every minute. Service checks for /proc/sys/net/ipv4/conf/tun0 directory existence (and this directory only exists when tun0 network interface is up) and restart the VPN connection service if directory doesn't exists (I don't have ipv6 enabled, so the path is valid for me).
Wanted to share my approach - may be somebody will find it useful. Any suggestions / ideas are welcome as well.
Offline