#!/usr/bin/env shVPNSRCIP="$(/sbin/ifconfig ovpnc1 | grep 'inet ' | cut -f1 -d '-' | awk '{ print $2}')"VPNGWIP="$(/sbin/ifconfig ovpnc1 | grep 'inet ' | cut -d ' ' -f 4)"if /sbin/ping -S "${VPNSRCIP}" -c 3 "${VPNGWIP}"; then # Success, Nothing to do exit 0else # Fail, Reconnect VPN configctl openvpn reloadfiexit 1