summaryrefslogtreecommitdiff
path: root/lib/daemon.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-06-28 16:12:23 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-06-28 16:12:23 -0400
commit6ca4dfa7ef42faf024599375b2ff81bfeb3d6208 (patch)
tree94b0a3098192c89e62b2755fe057d6453ce36d04 /lib/daemon.php
parent495c85544a740cd0330e73d9c48ca4b84f3d8e97 (diff)
Daemon can optionally not go into the background
Diffstat (limited to 'lib/daemon.php')
-rw-r--r--lib/daemon.php20
1 files changed, 15 insertions, 5 deletions
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()