rows;
}
function daemon_status($host, $pidname, $progname) {
$path = "../../pid_$host/$pidname.pid";
$running = false;
if (is_file($path)) {
$pid = file_get_contents($path);
if ($pid) {
$foo = exec("/opt/misc/bin/ssh $host ps w $pid");
if ($foo) {
if (strstr($foo, $progname)) {
$running = true;
}
}
}
}
return $running;
if ($running) {
echo "
$pidname is running on $host\n";
} else {
echo "
$pidname is not running on $host\n";
}
}
function show_status($host, $function, $running) {
echo "
$function | $host | ";
if ($running) {
echo "Running | \n";
} else {
echo "Not running | \n";
}
}
function show_daemon_status($host, $pidname, $progname) {
$running = daemon_status($host, $pidname, $progname);
show_status($host, $pidname, $running);
}
page_head("SETI@home status page");
echo "
Server status
Program | Host | Status |
";
$web_running = !file_exists("../../stop_web");
show_status("klaatu", "Data-driven web pages", $web_running);
$sched_running = !file_exists("../../stop_sched");
show_status("klaatu", "Scheduler", $sched_running);
show_daemon_status("kryten", "feeder", "feeder");
show_daemon_status("koloth", "file_deleter", "file_deleter");
show_daemon_status("klaatu", "transitioner1", "transitioner");
show_daemon_status("klaatu", "transitioner2", "transitioner");
show_daemon_status("kryten", "transitioner3", "transitioner");
show_daemon_status("kryten", "transitioner4", "transitioner");
show_daemon_status("klaatu", "sah_validate", "sah_validate");
show_daemon_status("galileo", "sah_assimilator", "sah_assimilator");
show_daemon_status("galileo", "sah_splitter", "sah_splitter");
show_daemon_status("milkyway", "sah_splitter2", "sah_splitter");
show_daemon_status("philmor", "sah_splitter3", "sah_splitter");
echo "
Database status
";
$retval = db_init_aux();
if ($retval) {
echo "The database server is not accessable";
} else {
echo "
State | Approximate #results |
";
$n = count_estimate("select count(*) from result where server_state=2");
echo "
Ready to send | ".number_format($n)." |
";
$n = count_estimate("select count(*) from result where server_state=4");
echo "
In progress | ".number_format($n)." |
";
}
page_tail(true);
end_cache(600);
?>