#!/usr/bin/perl BEGIN {push @INC, '/www/cgi-bin'}; use perlfunc; my $filename = '/tmp/snrlog/strongest'; my $MAXLINES=2880; # 2days worth ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); $d = sprintf ("%02d/%02d %02d:%02d:%02d",$mon, $mday,$hour, $min, $sec); ($s, $n) = get_wifi_signal(get_interface("wifi")); $s = 0 if $s eq "N/A"; $n = 0 if $n eq "N/A"; 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`; }