Daemon can optionally not go into the background
This commit is contained in:
parent
495c85544a
commit
6ca4dfa7ef
|
@ -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()
|
||||
|
|
|
@ -27,11 +27,12 @@ require_once(INSTALLDIR.'/classes/Notice.php');
|
|||
|
||||
class QueueHandler extends Daemon
|
||||
{
|
||||
|
||||
var $_id = 'generic';
|
||||
|
||||
function QueueHandler($id=null)
|
||||
function __construct($id=null, $daemonize=true)
|
||||
{
|
||||
parent::__construct($daemonize);
|
||||
|
||||
if ($id) {
|
||||
$this->set_id($id);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user