Ubuntu: Time controlled WLAN switching?



Question:

How can I automatically switch "off and on" the usage of a certain WLAN network BY TIME ?
(assuming the computer runs at that time)

Or alternatively how to switch off the Android-Hotspot by time ?

Background:
I arrive at 8:20 at work.
My laptop's internet connection runs via the mobile-phone-hotspot.
The mobile phone has a data-plan (2GB/month).
I sometimes forget to switch off the phone's hotspot.
I sometimes download large files (e.g. 350 MB).
Then I have no more data to surf, except if I purchase a dataplan-upgrade. Then in the evening I go home, and potentially the same happens...


Solution:1

The simplest answer might be a cron script or a Systemd Timer.

Alternatively, you might consider using a tool like ifmetric to give the mobile hotspot a lower priority, so that the system will automatically prefer to use another interface whenever one is available.

Edit: Apparently nmcli also has an autoconnect-priority setting, but it's not currently exposed through the GUI. That should also work for wireless networks which use the same interface. I would recommend using that solution instead, assuming you're on at least 16.04.

Quick summary of that answer:

To list all networks and their priorities:

nmcli -f NAME,UUID,AUTOCONNECT,AUTOCONNECT-PRIORITY c  

To set a network's priority:

nmcli connection modify <NAME> connection.autoconnect-priority <priority>  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »