Created
February 18, 2017 04:49
-
-
Save HostOnNet/f19f3a65e0edf4fe470232a1ff3d0a49 to your computer and use it in GitHub Desktop.
Reconnect to OpenVPN on disconnect
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 | |
| while true; do | |
| if ip a | grep -Eq ': tun0:.*state UP' | |
| then | |
| sleep 5 | |
| else | |
| echo "OpenVPN down, Reconnecting." | |
| openvpn --config /path/to/client.ovpn | |
| sleep 10 | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment