]> git.mxchange.org Git - friendica.git/commitdiff
poller: An optional lockfile is used to check if the poller is already running
authorMichael Vogel <icarus@dabo.de>
Sun, 1 Apr 2012 18:52:33 +0000 (20:52 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 1 Apr 2012 18:52:33 +0000 (20:52 +0200)
htconfig.php
include/poller.php

index 9d9c8a2c791ddd185a2d68949f4add5c5d6c76ec..63a40c8090417866535283e73af7dc7347a6bc36 100755 (executable)
@@ -83,5 +83,8 @@ $a->config['system']['no_regfullname'] = true;
 // If set to true the priority settings of ostatus contacts are used
 $a->config['system']['ostatus_use_priority'] = false;
 
-// If enabled all items are cached in the given directory
+// If enabled, all items are cached in the given directory
 $a->config['system']['itemcache'] = "";
+
+// If enabled, the lockpath is used for a lockfile to check if the poller is running
+$a->config['system']['lockpath'] = "";
index 90a97867c204e5abae28479262c8729e5320b242..499483d007dea6ecaffde1d9c4d0fffb420e79e3 100755 (executable)
@@ -25,10 +25,20 @@ function poller_run($argv, $argc){
        require_once('include/Contact.php');
        require_once('include/email.php');
        require_once('include/socgraph.php');
+       require_once('include/pidfile.php');
 
        load_config('config');
        load_config('system');
 
+       $lockpath = get_config('system','lockpath');
+       if ($lockpath != '') {
+               $pidfile = new pidfile($lockpath, 'poller.lck');
+               if($pidfile->is_already_running()) {
+                       logger("poller: Already running");
+                       exit;
+               }
+       }
+
        $a->set_baseurl(get_config('system','url'));
 
        load_hooks();