From 6ca4dfa7ef42faf024599375b2ff81bfeb3d6208 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 28 Jun 2009 16:12:23 -0400 Subject: Daemon can optionally not go into the background --- lib/daemon.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'lib/daemon.php') diff --git a/lib/daemon.php b/lib/daemon.php index a0df00bdc..72e8bc202 100644 --- a/lib/daemon.php +++ b/lib/daemon.php @@ -23,6 +23,13 @@ if (!defined('LACONICA')) { class Daemon { + var $daemonize = true; + + function __construct($daemonize = true) + { + $this->daemonize = $daemonize; + } + function name() { return null; @@ -129,12 +136,15 @@ class Daemon common_log(LOG_INFO, $this->name() . ' already running. Exiting.'); exit(0); } - if ($this->background()) { - $this->writePidFile(); - $this->changeUser(); - $this->run(); - $this->clearPidFile(); + + if ($this->daemonize) { + $this->background(); } + + $this->writePidFile(); + $this->changeUser(); + $this->run(); + $this->clearPidFile(); } function run() -- cgit v1.2.3