Making a bash script that reconnect to AP when connection lost

Posted by Alexander on Ask Ubuntu See other posts from Ask Ubuntu or by Alexander
Published on 2013-11-11T22:03:37Z Indexed on 2013/11/11 22:13 UTC
Read the original article Hit count: 453

Filed under:
|
|

I'm facing problems with WIFI on ubuntu i tried to update the system but still the same what happens is that i suddenly lose the connection with my router and when i press on the WIFI bar the system won't detect any APs i have to uncheck "enable WIFI" option ,then re check it so it work,it automatically reconnect.

I'm thinking of making a bash script that detects when the pc is disconnected from the router for any reason, and when it is disconnected it disable then enable the wifi. i mean like automating resetting the connection that possible ?

i guess i must use this

nmcli nm wifi off
nmcli nm wifi on

but how can i make the script know if the PC is disconnected from the WIFI ?

© Ask Ubuntu or respective owner

Related posts about wireless

Related posts about networking