1
0

-changed version info

-added "Client status" for checking whether the client runs
-made it Y2K
-added "Received/Sent last WU"
This commit is contained in:
Markus Birth 1999-07-31 10:49:54 +00:00
parent 4b60713969
commit f4bb23db1b

View File

@ -1,5 +1,5 @@
#!/usr/bin/perl #!/usr/bin/perl
# SETI@home stats 1.0 - shows current status of a running SETI-client in your browser # SETI@home stats 1.1 - shows current status of a SETI-client in your browser
# Copyright (C)1999 by Markus Birth <mbirth@webwriters.de> - GPL v2 # Copyright (C)1999 by Markus Birth <mbirth@webwriters.de> - GPL v2
# http://www.webwriters.de/mbirth/ # http://www.webwriters.de/mbirth/
@ -19,21 +19,37 @@
use CGI::Carp qw(fatalsToBrowser); use CGI::Carp qw(fatalsToBrowser);
$VERSION = "1.0"; $IMGDIR = "/cgi-data/setistats"; # The httpd-path to the images
$IMGDIR = "/cgi-data/setistats"; # this is that, what you would write in the
$SETIDIR = "/opt/SETI"; # <IMG>-tag .... if your IMG-tag is like
# <IMG SRC="../bla/bli/mypic.gif">
# then you would change this line to
# $IMGDIR = "../bla/bli";
$SETIDIR = "/opt/SETI"; # The local path to your SETI-directory
# (the place, where all the .txt-files are stored in)
$T_BOR = "black"; # Table border
$T_DBG = "#ffff80"; # Table description (left column) background
$T_VBG = "#ffffc0"; # Table value (right column) background
### END OF CONFIGURATION SECTION! ###
$VERSION = "1.1";
$ST = "$SETIDIR/state.txt"; $ST = "$SETIDIR/state.txt";
$UI = "$SETIDIR/user_info.txt"; $UI = "$SETIDIR/user_info.txt";
$WU = "$SETIDIR/work_unit.txt"; $WU = "$SETIDIR/work_unit.txt";
$VI = "$SETIDIR/version.txt"; $VI = "$SETIDIR/version.txt";
$BIN = "$SETIDIR/setiathome";
$T_BOR = "black"; # Table border open (GPID, "/sbin/pidof $BIN|");
$T_DBG = "#ffff80"; # Table descr. background $pid = <GPID>;
$T_VBG = "#ffffc0"; # Table value background close GPID;
chomp $pid;
$QS = $ENV{"QUERY_STRING"}; $QS = $ENV{"QUERY_STRING"};
print "Content-type: text/html\n"; print "Content-type: text/html\n\n";
# print "Expires: Thu Jan 01 00:00:00 1970 GMT\n\n"; # print "Expires: Thu Jan 01 00:00:00 1970 GMT\n\n";
# client version: version.txt # client version: version.txt
@ -83,8 +99,9 @@ sub UserInfo {
} }
&TableItem("Postal code", &Read($UI, "postal_code")); &TableItem("Postal code", &Read($UI, "postal_code"));
&TableItem("Country", &Read($UI, "country")); &TableItem("Country", &Read($UI, "country"));
&TableItem("Register time (GMT)", &JD2HMS(&Read($UI, "register_time"))); &TableItem("Register time", &JD2HMS(&Read($UI, "register_time")) . " (JD " . &ExtrJD(&Read($UI, "register_time")) . ")");
&TableItem("Register time (JD)", &ExtrJD(&Read($UI, "register_time"))); &TableItem("Received last WU", &JD2HMS(&Read($UI, "last_wu_time")) . " (JD " . &ExtrJD(&Read($UI, "last_wu_time")) . ")");
&TableItem("Sent last WU", &JD2HMS(&Read($UI, "last_result_time")) . " (JD " . &ExtrJD(&Read($UI, "last_result_time")) . ")");
&TableItem("Work Units", &Read($UI, "nwus") . " received, " . &Read($UI, "nresults") . " sent"); &TableItem("Work Units", &Read($UI, "nwus") . " received, " . &Read($UI, "nresults") . " sent");
&TableItem("Total CPU time", &time2HMS(&Read($UI, "total_cpu"))); &TableItem("Total CPU time", &time2HMS(&Read($UI, "total_cpu")));
&TableStop; &TableStop;
@ -97,7 +114,7 @@ sub WorkUnitInfo {
&TableItem("Record time (JD)", &ExtrJD(&Read($WU, "time_recorded"))); &TableItem("Record time (JD)", &ExtrJD(&Read($WU, "time_recorded")));
&TableItem("Receiver", "Arecibo Radio Observatory (" . &Read($WU, "receiver") . ")"); &TableItem("Receiver", "Arecibo Radio Observatory (" . &Read($WU, "receiver") . ")");
&TableItem("Tape version", &Read($WU, "tape_version")); &TableItem("Tape version", &Read($WU, "tape_version"));
&TableItem("Area", &Read($WU, "start_ra") . " R.A., " . &Read($WU, "start_dec") . " DEC - " . &Read($WU, "end_ra") . " R.A. " . &Read($WU, "end_dec") . " Dec"); &TableItem("Area", &Read($WU, "start_ra") . " R.A., " . &Read($WU, "start_dec") . " DEC - " . &Read($WU, "end_ra") . " R.A., " . &Read($WU, "end_dec") . " Dec");
&TableItem("Angle range", &Read($WU, "angle_range")); &TableItem("Angle range", &Read($WU, "angle_range"));
&TableItem("Subband number", &Read($WU, "subband_number")); &TableItem("Subband number", &Read($WU, "subband_number"));
&TableItem("Subband sample rate", &Read($WU, "subband_sample_rate")); &TableItem("Subband sample rate", &Read($WU, "subband_sample_rate"));
@ -122,7 +139,13 @@ sub WorkUnitInfo {
} }
sub StateInfo { sub StateInfo {
if ($pid) {
$CS = "<FONT COLOR=red><B>running</B></FONT> with PID $pid";
} else {
$CS = "<FONT COLOR=navy><B>not running</B></FONT> (or couldn't get the PID)";
}
&TableStart("Current State"); &TableStart("Current State");
&TableItem("Client status", "$CS");
&TableItem("Progress status", &Read($ST, "prog")*100 . "%"); &TableItem("Progress status", &Read($ST, "prog")*100 . "%");
&TableItem("Unit CPU time", &time2HMS(&Read($ST, "cpu"))); &TableItem("Unit CPU time", &time2HMS(&Read($ST, "cpu")));
&TableItem("Doppler shift rate", &Read($ST, "cr")); &TableItem("Doppler shift rate", &Read($ST, "cr"));
@ -276,10 +299,11 @@ sub JD2HMS {
# if ($month<10) { $month = "0" . "$month"; } # if ($month<10) { $month = "0" . "$month"; }
my $month = $months[$tim[4]]; my $month = $months[$tim[4]];
my $year = $tim[5]; my $year = $tim[5];
$year += 1900;
my $wday = $weekdays[$tim[6]]; my $wday = $weekdays[$tim[6]];
my $yday = $tim[7]; my $yday = $tim[7];
return "$month $mday 19$year / $hour:$min:$sec"; return "$month $mday $year / $hour:$min:$sec";
} }
sub ExtrJD { sub ExtrJD {