-
-
Save jonhkr/668dcf36969d4b3e00cc to your computer and use it in GitHub Desktop.
Openvpn auto reconnect
This file contains hidden or 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 | |
### Thanks Xream's Work XD | |
# | |
# just run: $ sudo auto-ovpn.sh config.ovpn | |
# | |
ovpn=$1 | |
getStatus () { | |
ifconfig | grep $1 && return 1 | |
return 0 | |
} | |
while true; do | |
getStatus tun0 | |
if [ $? -eq 0 ]; then | |
echo "openvpn is not connected!" | |
echo "Reconnecting!" | |
openvpn --config ${ovpn} | |
sleep 6 | |
fi | |
sleep 6 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment