diff --git a/html/user/db.inc b/html/user/db.inc index de1cddfb99..c5e28ae708 100644 --- a/html/user/db.inc +++ b/html/user/db.inc @@ -10,7 +10,9 @@ function db_init() { exit(); } $db_name = parse_config(""); - mysql_select_db($db_name); + if(!mysql_select_db($db_name)) return -1; + + return 0; } function lookup_user_auth($auth) { diff --git a/sched/wd.php b/sched/wd.php index 1f3aa86e0b..4414623c14 100755 --- a/sched/wd.php +++ b/sched/wd.php @@ -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"); diff --git a/sched/wd_nresults_changing.php b/sched/wd_nresults_changing.php index c6892057ff..26fd8265ab 100755 --- a/sched/wd_nresults_changing.php +++ b/sched/wd_nresults_changing.php @@ -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();