2015-07-26 22:09:34 -06:00
|
|
|
#!/usr/bin/perl
|
|
|
|
BEGIN {push @INC, '/www/cgi-bin'};
|
|
|
|
use perlfunc;
|
|
|
|
|
2015-08-10 17:25:55 -06:00
|
|
|
my $filename = '/tmp/snrlog';
|
|
|
|
my $MAXLINES=2880; # 2days worth
|
2015-07-26 22:09:34 -06:00
|
|
|
|
|
|
|
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
|
2015-07-28 15:16:01 -06:00
|
|
|
$d = sprintf ("%02d/%02d %02d:%02d:%02d",$mon, $mday,$hour, $min, $sec);
|
2015-07-26 22:09:34 -06:00
|
|
|
($s, $n) = get_wifi_signal(get_interface("wifi"));
|
2015-08-10 17:25:55 -06:00
|
|
|
$s = 0 if $s eq "N/A";
|
|
|
|
$n = 0 if $n eq "N/A";
|
2015-07-26 22:09:34 -06:00
|
|
|
|
|
|
|
open(my $fh, '>>', $filename) or die "Could not open file '$filename' $!";
|
|
|
|
print $fh "$d,$s,$n\n";
|
|
|
|
close $fh;
|
|
|
|
|
|
|
|
$lcount=`wc -l < $filename`;
|
|
|
|
chomp($lcount);
|
|
|
|
|
|
|
|
if($lcount>$MAXLINES)
|
|
|
|
{
|
|
|
|
$rc=`tail -n$MAXLINES $filename > $filename.tmp`;
|
|
|
|
$rc=`mv $filename.tmp $filename`;
|
|
|
|
}
|