#!/usr/local/perl -s
eval "exec /usr/local/perl -s -S $0 $*"
    if $running_under_some_shell;
			# this emulates #! processing on NIH machines.
			# (remove #! line above if indigestible)

#   This perl script is designed to do load statistics on bloom-beacon.

	open(PS,"/bin/ps ax |");
	open (DF, "/bin/df /dev/ra1c /dev/ra0g |");
	if (! $debug) {
		open(stdout,">>/usr/lib/news/logstats");
	}
	($sec, $min, $hour) = localtime(time);
	$_ = `/usr/local/uptime`;
	($users, $load15) =
		(/.*(\d+) user.* (\d+.\d+)$/i);
	<DF>;
	@spooldf = split(/[ \t\n]+/, <DF>);
	@sitedf = split(/[ \t\n]+/, <DF>);

	$discussd = 0;
	$nntpd = 0;
	<PS>;
	while (<PS>) {
		if (/discussd/) {
			$discussd++;
		}
		if (/nntpd/) {
			$nntpd++;
		}
	}		
	printf("%02s:%02s\t%s\t%s\t%s\t%s\t%s\t%s\n", $hour, $min, 
		$load15, $users, $spooldf[3], $sitedf[3],
		$discussd, $nntpd);
