#!/usr/bin/perl
#
# >>> Dave Hayes - Altadena CA, USA - dave@jetcafe.org <<<
# AUTONEWGROUP - Newgroups the top groups in the unwanted log 
#
# Where is the unwanted log?
$unwanted = "/usr/news/lib/syslogs/unwanted.log";
# Threshold of articles to cause a newgroup
$thresh = 400;
#
#####################
open(UNWANTED,"<$unwanted") || die "Can't open $unwanted: $!\n";
while(<UNWANTED>) {
    if (/^(\d+)\s+(\S+)/) {
	$n = $1; $grp = $2;
	system("/news/bin/ctlinnd newgroup $grp") if ($n >= $thresh);
    }
}
close(UNWANTED);