Created
October 23, 2016 07:57
-
-
Save mostafabahri/6735391088072ffb77d32e695347a5e5 to your computer and use it in GitHub Desktop.
Let the VPN stay connected.
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 | |
# don't forget to make it executable : chmod u+x vpn.sh | |
# run it : ./vpn.sh $vpnName | |
if [ -z ${1} ] | |
then | |
echo "No VPN name given."; | |
exit 1; | |
fi | |
while [[ true ]]; do | |
sleep 3; | |
nmcli connection show --active|grep vpn > /dev/null; | |
if [ $? -ne 0 ] | |
then | |
nmcli connection up "$1"; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment