#!/usr/bin/perl -w

$type=$ARGV[0];
die "type must be www, www1, or wwwc\n"
	unless (($type eq 'www') || ($type eq 'www1') ||
		($type eq 'wwwc'));

for $date ('19990327',
	   '19990320',
	   '19990313',
	   '19990306',
	   '19990227',
	   '19990220',
	   '19990213',
	   '19990206',
	   '19990130',
	   '19990123',
	   '19990116',
	   '19990109',
	   '19990102') {
  &execute("/opt/ACISweb/bin/getstats/run-gs-$type.pl $date");
}


sub execute {			# run a program and check the return code
    local(@args) = @_;
    local($rc) = 0xffff & system @args;
    if ($rc > 0x80) {
	$rc >>= 8;
	printf "%s\n  failed with return code $rc\n", "@args";
	exit(3);
    } elsif ($rc) {
	if ($rc & 0x80) {
	    $rc &= ~0x80;
	    print "coredump written\n";
	}
	printf "%s\n  aborted with signal $rc\n", "@args";
	exit(3);
    }
}
