#!/usr/athena/bin/perl -s
eval "exec /usr/athena/bin/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.
# changed to work on senator-bedfellow - 6/27/93 - mhg
        open(PS,"/bin/ps axww |");
        open (DF, "/bin/df /dev/rz0a /dev/rz6c /dev/rz1c /dev/rz2c |");
        if (! $debug) {
                open(stdout,">>/news/log/stats");
        }
        ($sec, $min, $hour) = localtime(time);
        $_ = `/usr/ucb/uptime`;
        ($users, $load15) =
                (/.*(\d+) user.* (\d+.\d+)$/i);
        <DF>;
        @bogusval = split(/[ \t\n]+/, <DF>);
        @slashdf = split(/[ \t\n]+/, <DF>);
        @vardf = split(/[ \t\n]+/, <DF>);
        @spooldf = split(/[ \t\n]+/, <DF>);
        @spool2df = split(/[ \t\n]+/, <DF>);

        $discussd = 0;
        $nnrpd = 0;
	$remcons = 0;
        <PS>;
        while (<PS>) {
                if (/discussd/) {
                        $discussd++;
                }
                if (/in\.nnrpd/) {
                        $nnrpd++;
                }
		if (/nnrpd\.real/) {
			$nnrpd++;
		}
                if (/innxmit/) {
	                $remcons++;
		}
	        if (/nntplink/) {
	                $remcons++;
		}
        }
        printf("%02s:%02s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", $hour, $min,
                $load15, $users, $slashdf[3], $vardf[3], $spooldf[3], 
		$spool2df[3], $discussd, $nnrpd, $remcons);
