From 4cf1e5aa21b3bcfac25d5ab95a2abccca48de523 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 1 Apr 2012 20:52:33 +0200 Subject: poller: An optional lockfile is used to check if the poller is already running --- include/poller.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/poller.php') 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(); -- cgit v1.2.3