In case someone is interested in this script for restarting the wireless interfaces on the friendly version.
#!/bin/perl -w## base code by Andrew Ault, www.andrewault.net## Free software. Use this as you wish.## This script solves an intermitent problem on my# Buffalo WZR-HP-AG300H wireless N radio. Every now and again# the wireless N radio has an issue and switches the 2.4G# extentsion band on and off which appears to stop the # wireless clients from connecting. The error in dmesg is:# "ath_beacon_generate: cabq queue did not stop?". Bringing# the wireless interface down and then back up resolves the issue. # This script monitors dmesg looking for the error and if found# restarts the wireless interfaces.#use strict;use warnings;use POSIX;# Wireless interface that disappearsmy $INTERFACELO='ath0';my $INTERFACEHI='ath10';my $ERROR='cabq queue did not stop';#my $daemonName = "beacon_check";#my $dieNow = 0; # used for "infinte loop" construct - allows daemon mode to gracefully exitmy $sleepMainLoop = 300; # number of seconds to wait between "do something" execution after queue is clearmy $aftercycle = 60; # amount to wait after shutting and starting interfaces before logging DMESGmy $logging = 1; # 1= logging is onmy $logFilePath = "/tmp/"; # log file pathmy $logFile = $logFilePath . $daemonName . ".log";## daemonizeuse POSIX qw(setsid);chdir '/';umask 0;open STDIN, '/dev/null' or die "Can't read /dev/null: $!";open STDOUT, '>>/dev/null' or die "Can't write to /dev/null: $!";open STDERR, '>>/dev/null' or die "Can't write to /dev/null: $!";defined( my $pid = fork ) or die "Can't fork: $!";# If parentexit if $pid;## For the child# dissociate this process from the controlling terminal that started it and stop being part# of whatever process group this process was a part of.POSIX::setsid() or die "Can't start a new session.";## callback signal handler for signals.$SIG{INT} = $SIG{TERM} = $SIG{HUP} = \&signalHandler;$SIG{PIPE} = 'ignore';## turn on loggingif ($logging) { open LOG, ">>$logFile"; select((select(LOG), $|=1)[0]); # make the log file "hot" - turn off buffering}## "infinite" loop where some useful process happensuntil ($dieNow) { sleep($sleepMainLoop); # Check for match against dmesg my $dmesg=`/bin/dmesg`; if ($dmesg=~ m/$ERROR/) { logEntry ("beacon queue failure detected!\n"); logEntry ("$dmesg\n"); system ("dmesg", "-c"); system ("ifconfig", "$INTERFACELO", "down"); system ("ifconfig", "$INTERFACEHI", "down"); sleep 3; system ("ifconfig", "$INTERFACELO", "down"); system ("ifconfig", "$INTERFACEHI", "down"); #sleep $aftercycle; }}## add a line to the log filesub logEntry { my ($logText) = @_; my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time); my $dateTime = sprintf "%4d-%02d-%02d %02d:%02d:%02d", $year + 1900, $mon + 1, $mday, $hour, $min, $sec; if ($logging) { print LOG "$dateTime : $logText\n"; }}## catch signals and end the program if one is caught.sub signalHandler { $dieNow = 1; # this will cause the "infinite loop" to exit}## do this stuff when exit() is called.END { if ($logging) { close LOG };}