3 require_once("boot.php");
6 function cronhooks_run(&$argv, &$argc){
14 @include(".htconfig.php");
15 require_once("include/dba.php");
16 $db = new dba($db_host, $db_user, $db_pass, $db_data);
17 unset($db_host, $db_user, $db_pass, $db_data);
20 require_once('include/session.php');
21 require_once('include/datetime.php');
22 require_once('include/pidfile.php');
24 load_config('config');
25 load_config('system');
27 $maxsysload = intval(get_config('system','maxloadavg'));
30 if(function_exists('sys_getloadavg')) {
31 $load = sys_getloadavg();
32 if(intval($load[0]) > $maxsysload) {
33 logger('system: load ' . $load . ' too high. Poller deferred to next scheduled run.');
38 $lockpath = get_config('system','lockpath');
39 if ($lockpath != '') {
40 $pidfile = new pidfile($lockpath, 'cron.lck');
41 if($pidfile->is_already_running()) {
42 logger("cronhooks: Already running");
47 $a->set_baseurl(get_config('system','url'));
51 logger('cronhooks: start');
53 $d = datetime_convert();
55 set_time_limit(9*60*60); // Setting the maximum execution time for cronjobs to 9 minutes.
57 call_hooks('cron', $d);
59 logger('cronhooks: end');
64 if (array_search(__file__,get_included_files())===0){
65 cronhooks_run($argv,$argc);