If it is connected it will sleep for a given time, e.g. It checks if a given VPN connection is active, and will connect if not.
#VPN AUTOCONNECT DOWNLOAD CODE#
I researched it a bit and combined some existing code to make my first bash script. Vpnautoconnect did not work for me in 12.04 LTS, and I dont seem to be the only one. To find out the value of YourVPNUUID for $VPNNAME simply run the following nmcli con list | grep -i vpn #not yet 3 falures - try starting normal way #TRY to knock hard way, resetting the network-manager (sometimes it happens in my kubuntu 12.04). Tested=$(nmcli con status uuid $VPNNAME | grep -c UUID) # enter desired time between checks here (in seconds) # YourVPN here is the name of desired vpn connection to monitor I would recommend checking out the script in this article: #!/bin/bash
#VPN AUTOCONNECT DOWNLOAD PASSWORD#
NetworkManager will now store the VPN password itself (see man nm-settings for details), and the network autoconnect will work once again. Change the line password-flags=1 to password-flags=0.sudoedit /etc/NetworkManager/system-connections/, where is the configuration file for your VPN (the filename is usually the name you assigned to your VPN).One workaround is to let NetworkManager store the password in plaintext in the configuration file in /etc/NetworkManager/system-connections/. It seems that NetworkManager fails to obtain the user's VPN password from gnome-keyring-daemon. If NetworkManager tries to automatically connect and fails, you will see a line like the following in /var/log/syslog: get_secrets_cb(): Failed to request VPN secrets #2: (6) No agents were available for this request. ( Edit: this bug has now been marked as "fix released" in Ubuntu 16.04). When this is enabled, there is a bug in NetworkManager that can break the "automatically connect to this network" function. Check "Automatically connect to VPN when using this connection" and select the desired VPN in the drop-down list.Select a network connection and click "Edit.".Click on the network tray applet and click "Edit connections.", or run nm-connection-editor.Through the Network Manager indicator nm-applet (the GNOME or Unity network tray applet installed by default), you can configure NetworkManager to automatically connect to a VPN when a network is connected.