]> git.mxchange.org Git - friendica.git/blobdiff - include/cronhooks.php
Merge pull request #1106 from silke/frost-mobile-modifications
[friendica.git] / include / cronhooks.php
index cf1d13765faf56d8d55b49bc5d6796cc677ede02..c0549dfff8a54734e00444dbe9df6197ef3af504 100644 (file)
@@ -35,11 +35,17 @@ function cronhooks_run(&$argv, &$argc){
                }
        }
 
-       $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,11 +56,12 @@ function cronhooks_run(&$argv, &$argc){
 
        logger('cronhooks: start');
 
-
        $d = datetime_convert();
 
        call_hooks('cron', $d);
 
+       logger('cronhooks: end');
+
        return;
 }