Skip to content

Instantly share code, notes, and snippets.

@HostOnNet
Created February 18, 2017 04:49
Show Gist options
  • Select an option

  • Save HostOnNet/f19f3a65e0edf4fe470232a1ff3d0a49 to your computer and use it in GitHub Desktop.

Select an option

Save HostOnNet/f19f3a65e0edf4fe470232a1ff3d0a49 to your computer and use it in GitHub Desktop.
Reconnect to OpenVPN on disconnect
#!/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