Skip to content

Instantly share code, notes, and snippets.

@CRTified
Created June 25, 2018 11:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CRTified/6ef9ac92442336cd7d42611748e2c0d8 to your computer and use it in GitHub Desktop.
Save CRTified/6ef9ac92442336cd7d42611748e2c0d8 to your computer and use it in GitHub Desktop.
Simple Openvpn Watchdog
[Unit]
Description=VPN watchdog
After=network.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'ping -I tun0 -c 1 8.8.8.8 > /dev/null || systemctl restart openvpn@configname.service'
[Install]
WantedBy=multi-user.target
[Unit]
Description=Check VPN connection
[Timer]
OnCalendar=hourly
[Install]
WantedBy=timers.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment