Skip to content

Instantly share code, notes, and snippets.

@bookercodes
Last active August 29, 2015 14:23
Show Gist options
  • Save bookercodes/22e5ee290849d105c1c9 to your computer and use it in GitHub Desktop.
Save bookercodes/22e5ee290849d105c1c9 to your computer and use it in GitHub Desktop.
[Desktop Entry]
Name=AutoVpn
Exec=/home/booker/connectVpn.sh
Type=Application
#!/bin/bash
while [ "true" ]
do
VPNCON=$(nmcli con show uuid 1e2fe74d-66dc-410c-9350-14f9a323bd39 | grep VPN.VPN-STATE | awk '{print $2}')
if [[ $VPNCON != "5" ]]; then
echo "Disconnected, trying to reconnect..."
(sleep 1s && nmcli con up uuid 1e2fe74d-66dc-410c-9350-14f9a323bd39)
else
echo "Already connected !"
fi
sleep 20
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment