User(s) browsing this thread: 1 Guest(s)
|
[Script] Automatic wifi connection drop detection and reconnect
|
|
06-28-2010, 11:32 PM
(This post was last modified: 06-28-2010 11:36 PM by mgtroyas.)
|
|||
|
|||
|
Hello,
First of all, I must say I absolutely love my PCH A-110, and the ability to directly download FullHD media to the HDD via torrent and wifi, for local storage and playback. But it also has some problems. One of them, perhaps not really fault of the NMT, is random wifi connection drop. Sometimes it stays connected for days, and others fail each half an hour. In order to fix it, I need to enter the NMT's network configuration, and re-apply the wifi settings. So it connects to the wifi network again. But for all the time it has been disconnected, it hasn't been downloading anything. So I developed a little script which pings to my router 4 times and, if any of the ICMP packets gets lost, kills and restarts the WPA supplicant proccess, reconnecting to the wifi network. It also mantains a log of reconnections on a text file: Code: suc=$(ping -c 4 -q 192.168.100.254 | awk '{if($1==4){print $4}}')Replace 192.168.100.254 with your router's IP. Also, make sure it answers to ping. Save the code on a text file on the hard disk, i.e. as "/share/cron.txt". Now we need this script to be executed periodically. Perhaps each hour. That's what cron is designed for. So we could append the script to the hourly cron file. It's simple: Code: cat /share/cron.txt >> /etc/cron.hourlyBut the problem is, as soon as we reboot the NMT, the crontab will be reset to default, losing our change. No problem: in order to apply it in each boot, we must simply append the line to the end of the "/share/start_app.sh" script, which gets executed exactly on every boot. Code: [...]So in every boot, the crontab will be modified, then the script will be executed hourly, and our wifi connection will be magically resumed whenever it has failed, with less of an hour of downtime. Also we will get a fancy log file with all the days and hours the router (Linksys WRT-120N in my case) has been so unkind to drop our beloved PCH. I've used this method for months and has server me very well. I hope it's also useful for many others! |
|||
2 users say Thank You to mgtroyas for this post |
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads... | |||||
| Thread: | Author | Replies: | Views: | Last Post | |
| [HOWTO] Ralink RT2870 wifi chipset | artbern | 8 | 11,602 |
02-04-2012 09:13 PM Last Post: anilech |
|
| [myiHome] linux package and daemon script | Shaika-Dzari | 8 | 6,526 |
01-12-2010 03:46 AM Last Post: JonnyRocket |
|
| [HOWTO] Ralink RT73 wifi chipsets | tiagor | 13 | 14,124 |
10-14-2009 11:34 AM Last Post: frendeze |
|
| HOWTO: Use secure password for your WiFi | ssuukk | 2 | 2,867 |
08-13-2009 06:03 AM Last Post: ssuukk |
|
| A script to re-mux all the files in a folder | npc100 | 0 | 2,725 |
07-19-2009 08:23 PM Last Post: npc100 |
|
| MKV transcoding script for Linux/*BSD/Mac users | onitake | 4 | 6,599 |
12-01-2008 01:35 PM Last Post: onitake |
|

Twitter
Facebook
NMT Wiki
Search
Member List
Help
[19. June 2013] Soundcloud® available now




![[+]](images/collapse_collapsed.gif)