2

When I'm connected to my metered mobile phone's wifi hotspot I would like to run a script to do things like kill the torrent downloader, stop syncthing, etc.

When I'm back on my unmetered home wifi hotspot, I'd like to automatically start those things up again.

When I connect to a new unknown hotspot, I'd like to ask the user whether it is metered or unmetered.


I would like my script to be called like:

wifi-connect.sh <SSID>

How do I setup this trigger?

I'm on a systemd system (Manjaro, based on Arch Linux).

... Or is there a tool out there which already does what I'm after?

  • What OS does your phone use? NetworkManager detects metered connections appropriately with some versions of Android, so it will flag your connection as metered when you’re using your phone’s hotspot, and unmetered when you’re using your wi-fi router at home. (That doesn’t answer your general question, I know.) – Stephen Kitt May 10 '17 at 11:47
  • Android 6.0.1, kernel 3.10.103 - and yes, this is supported. Thanks for a good nudge in the direction of a solution. – Tom Hale May 10 '17 at 12:53
  • In asking this question, I was looking for a UUID for a WiFi network. I thought it could be the ESSID, but it seems that an ESSID doesn't exist per se and is simply an SSID shared by all BSS in the ESS. So it appears there isn't a WiFi ESS UUID. – Tom Hale May 10 '17 at 14:29
  • What about the MAC address of the AP? That should be a fairly good proxy for a unique id for wi-fi networks. – Stephen Kitt May 10 '17 at 14:34
  • The MAC of a single AP (BSS) is part of the universally unique BSSID if I understand it correctly. However, if more than one AP is used due to range (an ESS) then the identifier is the non-unique SSID... I guess I could assume that all metered networks are only a single AP :) – Tom Hale May 10 '17 at 15:37
3

I've moved countries and the motivation behind the question is no longer there.

However, some pointers for when it becomes pertinent again:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.