]> git.mxchange.org Git - friendica.git/commitdiff
Add separate lock file for cronhooks, which might also take a long time and shouldn...
authorMatthew Exon <github.mexon@spamgourmet.com>
Tue, 12 Mar 2013 13:41:41 +0000 (14:41 +0100)
committerMatthew Exon <git.mexon@spamgourmet.com>
Thu, 28 Mar 2013 01:49:10 +0000 (09:49 +0800)
include/cronhooks.php

index 6aa0721363a9eb374142227d6541f1a5f2438359..48f157191679c7a9ef9cb355c5e56fc92dfe32b9 100644 (file)
@@ -19,15 +19,26 @@ function cronhooks_run(&$argv, &$argc){
 
        require_once('include/session.php');
        require_once('include/datetime.php');
+       require_once('include/pidfile.php');
 
        load_config('config');
        load_config('system');
 
+       $lockpath = get_config('system','lockpath');
+       if ($lockpath != '') {
+               $pidfile = new pidfile($lockpath, 'cron.lck');
+               if($pidfile->is_already_running()) {
+                       logger("cronhooks: Already running");
+                       exit;
+               }
+       }
+
        $a->set_baseurl(get_config('system','url'));
 
        load_hooks();
 
        logger('cronhooks: start');
+echo("@@@ cronhooks start\n");
        
 
        $d = datetime_convert();