$lockpath = get_config('system','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() > 9*60) {
+ $pidfile->kill();
+ logger("cronhooks: killed stale process");
+ // Calling a new instance
+ proc_run('php','include/cronhooks.php');
+ }
exit;
}
}
$d = datetime_convert();
- set_time_limit(9*60*60); // Setting the maximum execution time for cronjobs to 9 minutes.
-
call_hooks('cron', $d);
logger('cronhooks: end');
// Test
$lockpath = get_config('system','lockpath');
if ($lockpath != '') {
- $pidfile = new pidfile($lockpath, 'onepoll'.$contact_id.'.lck');
+ $pidfile = new pidfile($lockpath, 'onepoll'.$contact_id);
if($pidfile->is_already_running()) {
logger("onepoll: Already running for contact ".$contact_id);
exit;
public function is_already_running() {
return $this->_running;
}
+
+ public function running_time() {
+ return(time() - filectime($this->_file));
+ }
+
+ public function kill() {
+ if (file_exists($this->_file))
+ return(posix_kill(file_get_contents($this->_file), SIGTERM));
+ }
}
?>
$lockpath = get_config('system','lockpath');
if ($lockpath != '') {
- $pidfile = new pidfile($lockpath, 'poller.lck');
+ $pidfile = new pidfile($lockpath, 'poller');
if($pidfile->is_already_running()) {
logger("poller: Already running");
+ if ($pidfile->running_time() > 9*60) {
+ $pidfile->kill();
+ logger("poller: killed stale process");
+ // Calling a new instance
+ proc_run('php','include/poller.php');
+ }
exit;
}
}
$lockpath = get_config('system','lockpath');
if ($lockpath != '') {
- $pidfile = new pidfile($lockpath, 'queue.lck');
+ $pidfile = new pidfile($lockpath, 'queue');
if($pidfile->is_already_running()) {
logger("queue: Already running");
+ if ($pidfile->running_time() > 9*60) {
+ $pidfile->kill();
+ logger("queue: killed stale process");
+ // Calling a new instance
+ proc_run('php',"include/queue.php");
+ }
return;
}
}
logger('queue: start');
- set_time_limit(9*60*60); // Setting the maximum execution time for queue job to 9 minutes.
-
handle_pubsubhubbub();
$interval = ((get_config('system','delivery_interval') === false) ? 2 : intval(get_config('system','delivery_interval')));