LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 05-15-2012, 04:25 AM   #1
thekillerbean
Member
 
Registered: Jan 2002
Location: Melbourne, Australia
Distribution: Ubuntu 22.04 (Jammy)
Posts: 92

Rep: Reputation: 16
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!

Cheers,
ak.
 
Old 05-15-2012, 04:33 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
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.
 
Old 05-15-2012, 06:43 AM   #3
thekillerbean
Member
 
Registered: Jan 2002
Location: Melbourne, Australia
Distribution: Ubuntu 22.04 (Jammy)
Posts: 92

Original Poster
Rep: Reputation: 16
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.
 
Old 05-15-2012, 06:57 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
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.
 
Old 05-15-2012, 04:59 PM   #5
thekillerbean
Member
 
Registered: Jan 2002
Location: Melbourne, Australia
Distribution: Ubuntu 22.04 (Jammy)
Posts: 92

Original Poster
Rep: Reputation: 16
Thanks for response. Now, would you happen to know what those commands might be?

I've tried:
Code:
# ifconfig wlan0 up
No output but also nothing happens
Code:
# ifup wlan0
Ignoring unknown interface wlan0=wlan0.
What does that mean??? How do I make wlan0 wake up and make it search for a dhcp server and get an address?

Cheers,
ak.
 
Old 05-15-2012, 10:58 PM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
need a script to continuously monitor appended data to a log file akitty Programming 5 10-14-2010 02:39 AM
[SOLVED] Script for continuously checking if program running, need help tine Programming 4 11-04-2009 01:53 AM
Loop or check SQlite3 database continuously, when query found run script for first 3 Techno Guy Linux - Newbie 3 09-27-2009 07:46 PM
Script or program for continuously retrying to get an IP via DHCP Ken-ji Slackware 4 06-18-2008 12:30 AM
Check availability of packages on the install CD chandru.in Ubuntu 1 01-03-2006 07:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration