How to automatically detect when wpa_supplicant connects to a network
I wonder if there is a way to automatically detect when wpa_supplicant connects to a network.
Actually, when I connect to a protected network I run wpa_supplicant in background from the terminal then, when I see "Connection to blablabla..." (this may take different amounts of seconds, depending on many factors), I finally run dhclient to obtain an IP address.
I would like to make a script that does it all for me, but I need to know when wpa_supplicant is connected to run dhclient and maybe set a proxy.
I know I can use wpa_cli, but I'd like to avoid using a while loop that constantly checks if status is CONNECTED. I'd like to know if it's possible to receive some kind of notification instead.
Any help is truly appreciated.
Thank you so much.