About

This file monitors an OpenVPN instance as well as periodically pinging the gateway in order to make sure that the tunnel is up.

Code

The file assumes the following configuration:

###########################################################################
##  Copyright (C) Wizardry and Steamworks 2017 - License: GNU GPLv3      ##
###########################################################################
 
# The file assumes the following configuration:
#  * vpn-network.com is the network configured in /etc/openvpn/.
#  * tap0 is the TAP interface.
#  * 1.1.1.1 is the point-to-point VPN gateway.
 
check process vpn-network with pidfile /var/run/vpn-network.pid
   start program = "/etc/init.d/openvpn start vpn-network.com"
   stop program = "/etc/init.d/openvpn stop vpn-network.com"
 
check host tap0 with address 1.1.1.1
    start program = "/etc/init.d/openvpn start vpn-network.com"
    stop program = "/etc/init.d/openvpn stop vpn-network.com"
    if failed
        icmp type echo count 5 with timeout 15 seconds
    then restart