Skip to content

Instantly share code, notes, and snippets.

@mostafabahri
Created October 23, 2016 07:57
Show Gist options
  • Save mostafabahri/6735391088072ffb77d32e695347a5e5 to your computer and use it in GitHub Desktop.
Save mostafabahri/6735391088072ffb77d32e695347a5e5 to your computer and use it in GitHub Desktop.
Let the VPN stay connected.
#!/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