Last active
August 26, 2016 15:46
-
-
Save peelman/10a6564b6906ba43738773c621b81bd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
IP="10.x.x.x" | |
#Look for number of received pings, if 0 received then restart OpenVPN service | |
RESULT=`ping -c 2 -W 1 $IP | grep transmitted | awk '{print $4}'` | |
if [ $? -ne 0 ] && [ $RESULT -eq 0 ] | |
then | |
DATE=`date` | |
echo "OpenVPN restart on $DATE" | |
service openvpn restart | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment