Skip to content

Instantly share code, notes, and snippets.

@mjnaderi
Last active Dec 5, 2015
Embed
What would you like to do?
UpVPN (reconnect vpn when disconnected)
#!/bin/bash
VPN="Sharif ID"
trap "exit 0" SIGINT SIGTERM
while true; do
if ! nmcli con status | grep -q "$VPN"; then
echo "[`date`] Disconnected. Trying to reconnect..."
nmcli -p con up id "$VPN"
fi
sleep 2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment