protected function prepareSystemEnv()
{
register_shutdown_function(function () {
if ($this->pid != posix_getpid()) {
return;
}
if ($this->shutdown === true) {
return;
}
$this->log('Unexcepted shutdown.');
$this->shutdown(SIGTERM);
});
posix_setsid();
proc_nice(Daemon::$config->masterpriority->value);
if (!Daemon::$config->verbosetty->value) {
fclose(STDIN);
fclose(STDOUT);
fclose(STDERR);
}
$this->setTitle(Daemon::$runName . ': master process' . (Daemon::$config->pidfile->value !== Daemon::$config->pidfile->defaultValue ? ' (' . Daemon::$config->pidfile->value . ')' : ''));
}