watchdog fixes

svn path=/trunk/boinc/; revision=1025
This commit is contained in:
David Anderson 2003-03-06 19:53:32 +00:00
parent 384a181b4f
commit ad8ba413a3
3 changed files with 10 additions and 9 deletions

View File

@ -10,7 +10,9 @@ function db_init() {
exit();
}
$db_name = parse_config("<db_name>");
mysql_select_db($db_name);
if(!mysql_select_db($db_name)) return -1;
return 0;
}
function lookup_user_auth($auth) {

View File

@ -15,8 +15,8 @@
function sound_alarm($x) {
//echo "alarm: $x\n";
email("davea@ssl.berkeley.edu", "BOINC problem", $x);
email("eheien@ssl.berkeley.edu", "BOINC problem", $x);
mail("davea@ssl.berkeley.edu", "BOINC problem", $x);
mail("eheien@ssl.berkeley.edu", "BOINC problem", $x);
}
function check_log_file($file, $last_time) {
@ -32,7 +32,7 @@ function check_log_file($file, $last_time) {
$last_time = filemtime("watchdog_exec_time");
if (!$last_time) {
alarm("foo");
sound_alarm("Couldn't find watchdog_exec_time");
}
touch("watchdog_exec_time");

View File

@ -4,6 +4,7 @@
// watchdog script to ensure that the number of result records
// increases at least every X seconds (X = crontab period)
include_once("db.inc");
include_once("util.inc");
function fail($x) {
@ -42,16 +43,14 @@ function get_count_from_db() {
}
$retval = db_init();
if (!$retval) {
fail("Can't open database");
if ($retval != 0) {
fail("Can't open database\n");
}
$m = get_count_from_db();
echo "Count: $m\n";
if ($m == false) {
fail("Can't get result count from DB");
fail("Can't get result count from DB\n");
}
$n = read_count_file();
echo "Count: $n\n";
if ($n == false) {
write_count_file($m);
exit();