Advertisement
Guest User

AutoVPN

a guest
May 21st, 2012
1,651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.90 KB | None | 0 0
  1. #because the autoconnect VPN has been broken in gnome for quite some time here is a little fix for it. Its simple, so if you want you could add graphics/etc.
  2.  
  3. #!/bin/bash
  4. echo "which vpn do you want?
  5. 1: WA
  6. 2: NY"
  7. read VPN
  8.  
  9. if [ "$VPN" = "1" ]
  10. then
  11. VPN_CONNECTION_NAME="WA" # change the quotes to your VPN connection name
  12.  
  13. elif [ "$VPN" = "2" ]
  14. then
  15. VPN_CONNECTION_NAME="NY" # change the quotes to your VPN connection name
  16.  
  17. fi
  18.  
  19. activ_con=$(nmcli con status | grep "${REQUIRED_CONNECTION_NAME}")
  20. activ_vpn=$(nmcli con status | grep "${VPN_CONNECTION_NAME}")
  21.  
  22.  
  23. if [ "${activ_con}" -a ! "${activ_vpn}" ];
  24. then
  25.     nmcli con up id "${VPN_CONNECTION_NAME}"
  26. else
  27.     echo "You were not connected."
  28. fi
  29.  
  30. sleep 60
  31. # dont forget to chmod+x the file after you copy/paste this.
  32. # credit due to qertoip on http://thesingularity.pl/blog/2011/solved-how-to-auto-connect-to-a-vpn-on-startup-in-ubuntu-11-10/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement