load_config('config');
load_config('system');
- $lockpath = get_config('system','lockpath');
+ $lockpath = get_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;
}
}
}
if (array_search(__file__,get_included_files())===0){
- queue_run($argv,$argc);
+ queue_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}