[Bpft4-cvs] dailytraffic 900.traffic,1.11,1.12
Status: Beta
Brought to you by:
stas_degteff
From: Stas D. <sta...@us...> - 2006-06-29 14:24:26
|
Update of /cvsroot/bpft4/dailytraffic In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29090 Modified Files: 900.traffic Log Message: Add summary month Index: 900.traffic =================================================================== RCS file: /cvsroot/bpft4/dailytraffic/900.traffic,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- 900.traffic 30 Dec 2003 06:36:00 -0000 1.11 +++ 900.traffic 29 Jun 2006 14:24:20 -0000 1.12 @@ -7,9 +7,13 @@ # $iface = 'xl0'; -$myaddr='192.168.254.1'; -$out_to = '|/usr/sbin/sendmail root'; -#$out_to = ">aaa"; +($hostname = `hostname`) =~ s/\n//g; +$toaddr = 'root\@$hostname'; +$out_to = '|/usr/sbin/sendmail $toaddr'; +$summaryfile = "/var/log/trafficsumm"; + +$myaddr=`ifconfig $iface | grep "inet " | cut -d " " -f 2`; +chomp $myaddr; ($tempfile = $0) =~ s%.*/%%; $tempfile = "/tmp/$tempfile.tmp"; @@ -27,7 +31,6 @@ # Mail header # -($hostname = `hostname`) =~ s/\n//g; #chomp($daydate = `date -v-1d "+%a, %d %b %Y"`); my @monthnames = qw/ Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec /; @@ -49,7 +52,7 @@ } print OUT <<HDR; -To: <root\@$hostname> +To: <$toaddr> Date: $date From: "Traffic daily script" <root\@$hostname> Subject: IP statistics @@ -168,6 +171,12 @@ close OUT; unlink $tempfile; +if( open S, ">>$summaryfile" ) { + print S "$year-",$mon+1,"-$mday,",$trafficsum{"world"},",", + $trafficsum{"city"},",",$trafficsum{"local"},"\n"; + close S; +} + exit; sub testtraffic(){ |