Debian Codegraph @

contrib/mrtg-mail/mailstats-alternate

raw
1 # use this method if you think it is better...
2 # I did this one after I learnt a bit more perl!
3
4
5 ##
6 # munge the output data
7 #
8 while (<SOCK>) {
9 $line = $_;
10 ($a, $curfrm, $b, $curto, $c, $d) = split(' ',$line);
11 }
12 if ($a = "T") {
13 # do some sums
14 $msgsfrm = $curfrm - $oldfrm;
15 $msgsto = $curto - $oldto;
16 chomp $msgsfrm;
17 chomp $msgsto;
18
19 # open the old file for overwrite
20 open (OLD,">/tmp/mailstat.old") or die "can't open file!\n";
21 # print the data for mrtg
22 print "$msgsfrm\n$msgsto\n1\n$remote\n";
23
24 # print the data to the old file
25 print OLD "$curfrm $curto\n";
26 } #endif
27
28 close (SOCK) or die "close: $!";
29 exit;