X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fcronhooks.php;h=26cab3cf92a86a0c3a2b566f3d24dc56ed7e356c;hb=f8ba1b6fae70896f3fc6875e2bdbc1b1bc0cacc5;hp=cf1d13765faf56d8d55b49bc5d6796cc677ede02;hpb=84189ac775b3e1bc36d9e9d8945624c1bca7fb55;p=friendica.git diff --git a/include/cronhooks.php b/include/cronhooks.php index cf1d13765f..26cab3cf92 100644 --- a/include/cronhooks.php +++ b/include/cronhooks.php @@ -30,16 +30,22 @@ function cronhooks_run(&$argv, &$argc){ if(function_exists('sys_getloadavg')) { $load = sys_getloadavg(); if(intval($load[0]) > $maxsysload) { - logger('system: load ' . $load . ' too high. Poller deferred to next scheduled run.'); + logger('system: load ' . $load[0] . ' too high. Cronhooks deferred to next scheduled run.'); return; } } - $lockpath = get_config('system','lockpath'); + $lockpath = get_lockpath(); if ($lockpath != '') { - $pidfile = new pidfile($lockpath, 'cron.lck'); + $pidfile = new pidfile($lockpath, 'cronhooks'); if($pidfile->is_already_running()) { logger("cronhooks: Already running"); + if ($pidfile->running_time() > 19*60) { + $pidfile->kill(); + logger("cronhooks: killed stale process"); + // Calling a new instance + proc_run('php','include/cronhooks.php'); + } exit; } } @@ -50,15 +56,16 @@ function cronhooks_run(&$argv, &$argc){ logger('cronhooks: start'); - $d = datetime_convert(); call_hooks('cron', $d); + logger('cronhooks: end'); + return; } if (array_search(__file__,get_included_files())===0){ - cronhooks_run($argv,$argc); + cronhooks_run($_SERVER["argv"],$_SERVER["argc"]); killme(); }