X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fdaemon.php;h=231f5414e9ab44a7e66faf338ddf2fef31d9982d;hb=ac75772150c3fe9411408ac44db04e774d095aa0;hp=e88215c0e3dfaeb99752dbbca973a6ea63f580bc;hpb=793a6a1155996a7bcdc068fc891e7063934bdb19;p=quix0rs-gnu-social.git diff --git a/lib/daemon.php b/lib/daemon.php index e88215c0e3..231f5414e9 100644 --- a/lib/daemon.php +++ b/lib/daemon.php @@ -1,7 +1,7 @@ daemonize = $daemonize; + } + function name() { return null; } + function get_id() + { + return $this->_id; + } + + function set_id($id) + { + $this->_id = $id; + } + function background() { $pid = pcntl_fork(); @@ -129,12 +147,16 @@ 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) { + common_log(LOG_INFO, 'Backgrounding daemon "'.$this->name().'"'); + $this->background(); } + + $this->writePidFile(); + $this->changeUser(); + $this->run(); + $this->clearPidFile(); } function run()