From: USC Listproc Manager NOTES: I'm not sure who wrote this script, but it seems to contain most of what you are looking for. You are welcome to it. Be sure to modify out the USC specific stuff... It runs from cron as one of the daily jobs and sends it to me as email. The script is called 'uscstats' `usc_utils/uscstats > $filename`; `cat $filename | mail -s "Listproc Daily Stats" $manager`; --------------------- #!/usr/usc/bin/perl # uscstats - display and update a running count of stats for each list # use getpwnam to get the home directory because this is a cronjob. ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $LPDIR, $shell) = (getpwnam("listproc")); #manager name lookup $mgrline = `grep -v "#" $LPDIR/config | grep manager`; ($tag, $manager) = split(/ +/,$mgrline); chdir "$LPDIR/lists"; opendir(LISTS, "."); @dirs = sort(grep(-d, readdir(LISTS))); closedir LISTS; ($x1, $x2, $x3, $day,$month,$year) = localtime(time); $month++; $year += 1900; $date = sprintf("%02d/%02d/%02d",$year,$month,$day); print "Date\t\tNew\tTotal\t#Subs\t#Msgs\t#Errors\tListname\n"; $total = 0; $totnew = 0; $totmsg = 0; $totsub = 0; $toterr = 0; $errs = 0; $lists = 0; $subs = 0; $subscribers = 0; foreach $dir (@dirs) { next unless (-f "$dir/.subscribers"); `touch $dir/.msgno`; # make sure it's there `touch $dir/.msgno.old`; # make sure it's there $oldline = `cat $dir/.msgno.old`; $newline = `cat $dir/.msgno`; ($old) = ($oldline =~ /^(\d+)/); ($new) = ($newline =~ /^(\d+)/); if ($new < $old) { $new = $old; }; $tmpsub = `wc -l $dir/.subscribers`; ($subs) = ($tmpsub =~ /(\d+)/); $msgs = $subs * ($new - $old); $errs = 0; if (-e "$dir/.errors.te") { $tmpsub = `wc -l $dir/.errors.te`; ($errs) = ($tmpsub =~ /(\d+)/); }; print "$date\t",$new - $old, "\t$new\t$subs\t$msgs\t$errs\t$dir\n"; $total += $new; $totnew += $new - $old; $totmsg += $msgs; $totsub += $subs; $toterr += $errs; unlink "$dir/.msgno.old"; `cp $dir/.msgno $dir/.msgno.old`; $lists++; } $inc = `grep -c LISTPROCESSOR $LPDIR/.report.catmai`; chop $inc; $incsub = 0; $oldinc = `cat $LPDIR/usc_utils/.incoming.cnt`; $totinc = $inc + $oldinc; $msgs = 0; $errs = 0; $dir = '*LISTPROC'; print "$date\t$inc\t$oldinc\t$incsub\t$msgs\t$errs\t$dir\n"; open(INC,">$LPDIR/usc_utils/.incoming.cnt"); print INC "$totinc"; close(INC); $total += $totinc; $totnew += $inc; print "$date\t$totnew\t$total\t$totsub\t$totmsg\t$toterr\t*TOTAL\n"; ----