View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 3 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Tue Nov 20, 2007 8:39 pm 
Offline
Joined: Tue Nov 20, 2007 8:31 pm
Posts: 1
I am using a USB wireless network device. When my myth box starts up, the wireless network comes up normally. However, overtime, the box looses its network connection and does not automatically reconnect to the preferred network. I have to reboot the box to get it to connect again (or bring up a shell and restart the network). Is there anyway to have knoppmyth automatically reconnect the wireless network?

Thanks, David Robison


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 20, 2007 11:43 pm 
Offline
Site Admin
Joined: Fri Sep 19, 2003 6:37 pm
Posts: 2659
Location: Whittier, Ca
You could write a script that restarts network. Then create a cron job that runs at X interval.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 21, 2007 8:37 am 
Offline
Joined: Tue Feb 21, 2006 7:24 am
Posts: 396
Location: Dushanbe, Tajikistan
Here is one that I wrote to check my connection, this is called from crontab every ten minutes.. What is does is try to ping the default gateway address, if it gets a response it exits -- if not restarts the connection and logs the event to syslog.

Code:
#!/usr/bin/perl

open(DE,"route -n|");

while(<DE>){
    /^0\.0\.0\.0\s+(\d+\.\d+\.\d+\.\d+)/;
    $def=$1 if $1;
}

open(PING,"ping -c2 $def 2>/dev/null |");

while(<PING>){
    /\d+\sbytes\sfrom.*(ms)/;
    $res=$1 if $1;
}

exit if $res;

system("/usr/bin/con > /dev/null 2>&1");
system("/usr/bin/logger Wireless Connection Restart");


/usr/bin/con is the script that restarts the connection:
/usr/bin/con
Code:
#!/bin/bash
killall -v dhclient
iwlist wlan0_rename scan
dhclient wlan0_rename


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: Bing [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu