aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Vogel <icarus@dabo.de>2012-04-01 20:52:33 +0200
committerMichael Vogel <icarus@dabo.de>2012-04-01 20:52:33 +0200
commit4cf1e5aa21b3bcfac25d5ab95a2abccca48de523 (patch)
treea2b1d511b05b717b4a1cf8a63849d5d235f38a7f
parent7d23149a61f75923b2c71a288a722ee219f5e6ba (diff)
downloadvolse-hubzilla-4cf1e5aa21b3bcfac25d5ab95a2abccca48de523.tar.gz
volse-hubzilla-4cf1e5aa21b3bcfac25d5ab95a2abccca48de523.tar.bz2
volse-hubzilla-4cf1e5aa21b3bcfac25d5ab95a2abccca48de523.zip
poller: An optional lockfile is used to check if the poller is already running
-rwxr-xr-xhtconfig.php5
-rwxr-xr-xinclude/poller.php10
2 files changed, 14 insertions, 1 deletions
diff --git a/htconfig.php b/htconfig.php
index 9d9c8a2c7..63a40c809 100755
--- a/htconfig.php
+++ b/htconfig.php
@@ -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'] = "";
diff --git a/include/poller.php b/include/poller.php
index 90a97867c..499483d00 100755
--- a/include/poller.php
+++ b/include/poller.php
@@ -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();