Index: trunk/pstamp/scripts/pstamp_server_status
===================================================================
--- trunk/pstamp/scripts/pstamp_server_status	(revision 30469)
+++ trunk/pstamp/scripts/pstamp_server_status	(revision 30517)
@@ -46,9 +46,4 @@
 
 
-my $down = 0;
-if ($down) {
-    print "Postage Stamp Server will be down for maintenance it will back at approximately 00:00 2010-12-11 UTC\n";
-    exit 0;
-}
 
 my $now = `date -u`;
@@ -56,97 +51,119 @@
 print "<b>Status updated: &nbsp;&nbsp;&nbsp;</b> $now<br /><br />\n";
 
-my ($pts, $pantasks_script) = tempfile ('/tmp/pts.XXXX', UNLINK => !$save_temps);
+my $down = 0;
+if ($down) {
+    print "Postage Stamp Server will be down for maintenance it will back at approximately 00:00 2010-12-11 UTC\n";
+    # exit 0;
+} else {
+    # talk to pantasks_server and get the status
 
-print $pts "status\n";
-print $pts "quit\n";
-close $pts;
+    my ($pts, $pantasks_script) = tempfile ('/tmp/pts.XXXX', UNLINK => !$save_temps);
 
-my $command = "$pantasks_client < $pantasks_script";
-my  ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-    run(command => $command, verbose => $verbose);
-unless ($success) {
-    $error_code = (($error_code >> 8) or 1);
-    if ($error_code == 12) {
-        #print "Postage Stamp Server is not running\n";
-        print "Postage Stamp Server will be down for maintenance it will back shortly.\n";
-        exit 0;
+    print $pts "status\n";
+    print $pts "quit\n";
+    close $pts;
+
+
+    my $command = "$pantasks_client < $pantasks_script";
+    my  ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $verbose);
+    unless ($success) {
+        $error_code = (($error_code >> 8) or 1);
+        if ($error_code == 12) {
+            #print "Postage Stamp Server is not running\n";
+            print "Postage Stamp Server will be down for maintenance it will back shortly.\n";
+            exit 0;
+        } else {
+            warn("$command failed. exit status: $error_code");
+            exit $error_code;
+        }
     }
-    warn("$command failed. exit status: $error_code");
-    exit $error_code;
-}
 
-my $output = join "", @$stdout_buf;
+    my $output = join "", @$stdout_buf;
 
-print "$output" if $verbose;
+    print "$output" if $verbose;
 
-my @lines = split "\n", $output;
+    my @lines = split "\n", $output;
 
-my ($scheduler_state, $controller_state);
-my $got_state = 0;
-my %tasks;
-foreach my $line (@lines) {
-    chomp $line;
-    next if !$line;
-    my ($first, $second, $third);
+    my ($scheduler_state, $controller_state);
+    my $got_state = 0;
+    my %tasks;
+    foreach my $line (@lines) {
+        chomp $line;
+        next if !$line;
+        my ($first, $second, $third);
 
-    if ($line =~ /Scheduler is/) {
-        ($first, $second, $scheduler_state) = split " ", $line;
-        $got_state = 1;
-#        print "$first $second $third $scheduler_state\n";
-    } elsif ($line =~ /Controller is/) {
-        ($first, $second, $controller_state) = split " ", $line;
-#        print "$first $second $third $controller_state\n";
-    } elsif ($got_state == 1 and $line =~ /\+|\-/) {
-#        print "$line\n";
-        my ($task_state, $task, $nrun, $njobs, $ngood, $nfail, $ntime, $cmd) = split " ", $line;
-#        print "$task $task_state\n";
-        my %this_task = ( name => $task, nrun=> $nrun, njobs => $njobs, ngood => $ngood, nfail => $nfail, ntime => $ntime, cmd => $cmd ); 
+        if ($line =~ /Scheduler is/) {
+            ($first, $second, $scheduler_state) = split " ", $line;
+            $got_state = 1;
+    #        print "$first $second $third $scheduler_state\n";
+        } elsif ($line =~ /Controller is/) {
+            ($first, $second, $controller_state) = split " ", $line;
+    #        print "$first $second $third $controller_state\n";
+        } elsif ($got_state == 1 and $line =~ /\+|\-/) {
+    #        print "$line\n";
+            my ($task_state, $task, $nrun, $njobs, $ngood, $nfail, $ntime, $cmd) = split " ", $line;
+    #        print "$task $task_state\n";
+            my %this_task = ( name => $task, nrun=> $nrun, njobs => $njobs, ngood => $ngood, nfail => $nfail, ntime => $ntime, cmd => $cmd ); 
 
-        # change '.' in task name to '_' so we have a valid hash key
-        $task =~ s/\./\_/g;
-        $tasks{$task} =  \%this_task;
+            # change '.' in task name to '_' so we have a valid hash key
+            $task =~ s/\./\_/g;
+            $tasks{$task} =  \%this_task;
+        }
+    }
+
+    if ($scheduler_state) {
+        print "Pantasks Scheduler $scheduler_state.\n";
+        if ($controller_state) {
+            print $br . "Pantasks Controller $controller_state.\n";
+        } else {
+            print STDERR "Controller state not found";
+            exit 1;
+        }
+        print "$br$br\n";
+    } else {
+        print STDERR "Scheduler state not found";
+        exit 1;
+    }
+
+    my $request_run = $tasks{'pstamp_request_run'};
+    my $request_fin = $tasks{'request_finish_run'};
+    my $job_run = $tasks{'pstamp_job_run'};
+
+
+    if ($request_run) {
+	# print "<br >\n";
+        print "<b>Parser Status:</b> $request_run->{nrun} running. $request_run->{ngood} parsed successfully.&nbsp; $request_run->{nfail} failed to parse.";
+        if ($request_fin) {
+            print "  $request_fin->{ngood} Requests finished.";
+        } else {
+            print "Task request.finish.run not found.\n";
+        }
+        print "\n";
+        print "\n";
+        if ($job_run) {
+            print "<br /><b>Job Status:</b> &nbsp;&nbsp; $job_run->{nrun} running. &nbsp; $job_run->{ngood} completed successfully. &nbsp; $job_run->{nfail} failed";
+            print "<br />\n";
+        } else {
+            print "Task pstamp.job.run not found.<br />\n";
+        }
+    } else {
+        print "Task pstamp.request.run not found.\n";
     }
 }
 
-if ($scheduler_state) {
-    print "Pantasks Scheduler $scheduler_state.\n";
-    if ($controller_state) {
-        print $br . "Pantasks Controller $controller_state.\n";
-    } else {
-        print STDERR "Controller state not found";
-        exit 1;
-    }
-    print "$br$br\n";
-} else {
-    print STDERR "Scheduler state not found";
-    exit 1;
-}
+# now run the script psstatus to check the status of running requests and finished requests
+print "<br /><b>Unfinished Requests</b><br />\n";
+print "<pre>\n";
+system "$status_cmd --totals";
+print "</pre>\n";
 
-my $request_run = $tasks{'pstamp_request_run'};
-my $request_fin = $tasks{'request_finish_run'};
-my $job_run = $tasks{'pstamp_job_run'};
+#print "<br />\n";
 
 
-if ($request_run) {
-    print "<br /><b>Parser Status:</b> $request_run->{nrun} running. $request_run->{ngood} parsed successfully.&nbsp; $request_run->{nfail} failed to parse.";
-    if ($request_fin) {
-        print "  $request_fin->{ngood} Requests finished.";
-    } else {
-        print "Task request.finish.run not found.\n";
-    }
-    print "\n";
-    print "\n";
-    if ($job_run) {
-        print "<br /><b>Job Status:</b> &nbsp;&nbsp; $job_run->{nrun} running. &nbsp; $job_run->{ngood} completed successfully. &nbsp; $job_run->{nfail} failed";
-        print "<br />\n";
-    } else {
-        print "Task pstamp.job.run not found.<br />\n";
-    }
-
-    # now run the script psstatus to check the status of running requests and finished requests
-    print "<br /><b>Unfinished Requests</b><br />\n";
-    print "<pre>\n";
-    system "$status_cmd --running";
-    print "</pre>\n";
+# print "<br /><b>Unfinished Requests</b><br />\n";
+print "<pre>\n";
+system "$status_cmd --running";
+print "</pre>\n";
 
 if (0) {
@@ -158,13 +175,8 @@
 }
 
-    print "<br /><b>Requests completed in last 24 hours (most recently completed first)</b><br />\n";
-    print "<pre>\n";
-    system "$status_cmd --finished";
-    print "</pre>\n";
-
-} else {
-    print "Task pstamp.request.run not found.\n";
-}
-
+print "<br /><b>Requests completed in last 24 hours (most recently completed first)</b><br />\n";
+print "<pre>\n";
+system "$status_cmd --finished";
+print "</pre>\n";
 
 
