How can I configure Linux to continuously check for wireless availability via script!
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How can I configure Linux to continuously check for wireless availability via script!
Hello all.
I've got an issue with the way Linux tries to reconnect to a wireless access point after it loses connection. It appears that after a few failed attempts at re-establishing the link, it stops and never tries again. Manually accessing the Network tray icon and selecting the AP causes it to reconnect without dramas until the next time it goes down!
I'm now looking to do the manual part via a bash script but I have no idea what the GUI action of selecting the AP from the Network icon translates to in terms of manual CLI commands. Any chance anyone here has solved such a problem before? I hate to have to re-invent the wheel unless absolutely necessary!
I do not suggest you to create GUI actions from the bash CLI. You will only need command line tools to check network, reconnect. But you would also need to find why is it disconnected.
The wireless connection is going down due to a dirty line and although it has been reported to the ISP, I'm still waiting on it to be fixed. In the meantime I'm looking for a workaround. When the link goes down, the ADSL modem, also functioning as the AP, has to be rebooted. Sometimes the reboot occurs fast enough and the Linux box I'm trying to access remotely can reconnect. However, there are times when the reboot takes longer and that is when the wireless scanning timeouts and never attempts to reconnect again until manual intervention.
Now, back to your other question - I'm not trying to manipulate the GUI with a script, I'm trying to understand whether the GUI actions can be duplicated via a script. For instance, I could open a file with Kate and add some text to it then save it. I could perform these same steps by echoing some text to a file via the CLI. This is what I'm after and I hope that clears up any ambiguity in the previous post!
Cheers,
ak.
Last edited by thekillerbean; 05-15-2012 at 06:45 AM.
I see, just it works reversely: usually the gui will translate the events (that is for example a click) to some commands and executes them in a shell. So you do not need to take care about those GUI events, you only need to execute the command belongs to that event.
There are editors and other GUIs which works without command line backends, so events are handled directly without shells and scripts, but the system resources like your AP are script driven.
Oh yes, we almost lost....
So as root you can execute ifconfig and it will tell you what is the name of your network card. (I think it is now wlan0).
ifup works with /etc/network/interfaces, so you need to look into that file. I assume you have a line something like this: allow-hotplug wlan0
I suggest you to replace it with: iface wlan0 inet dhcp
(or there is another solution without DHCP).
After this you will be able to run ifup and ifdown on wlan0. Actually I'm not really sure about this solution because I have never had wireless cards and such problems, and also you may have different settings.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.