3 require_once("boot.php");
4 require_once("include/socgraph.php");
7 function discover_poco_run(&$argv, &$argc){
15 @include(".htconfig.php");
16 require_once("include/dba.php");
17 $db = new dba($db_host, $db_user, $db_pass, $db_data);
18 unset($db_host, $db_user, $db_pass, $db_data);
21 require_once('include/session.php');
22 require_once('include/datetime.php');
23 require_once('include/pidfile.php');
25 load_config('config');
26 load_config('system');
28 $maxsysload = intval(get_config('system','maxloadavg'));
31 if(function_exists('sys_getloadavg')) {
32 $load = sys_getloadavg();
33 if(intval($load[0]) > $maxsysload) {
34 logger('system: load ' . $load[0] . ' too high. discover_poco deferred to next scheduled run.');
39 $lockpath = get_lockpath();
40 if ($lockpath != '') {
41 $pidfile = new pidfile($lockpath, 'discover_poco');
42 if($pidfile->is_already_running()) {
43 logger("discover_poco: Already running");
44 if ($pidfile->running_time() > 19*60) {
46 logger("discover_poco: killed stale process");
47 // Calling a new instance
48 proc_run('php','include/discover_poco.php');
54 $a->set_baseurl(get_config('system','url'));
60 if (get_config('system','poco_discovery') > 0)
68 if (array_search(__file__,get_included_files())===0){
69 discover_poco_run($_SERVER["argv"],$_SERVER["argc"]);