本文整理汇总了PHP中Daemon::shm_wstate方法的典型用法代码示例。如果您正苦于以下问题:PHP Daemon::shm_wstate方法的具体用法?PHP Daemon::shm_wstate怎么用?PHP Daemon::shm_wstate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Daemon
的用法示例。
在下文中一共展示了Daemon::shm_wstate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
//.........这里部分代码省略.........
Daemon::log('You must have the root privileges to change group.');
$error = TRUE;
}
}
if (isset(Daemon::$config->user->value) && is_callable('posix_getuid')) {
if (($su = posix_getpwnam(Daemon::$config->user->value)) === FALSE) {
Daemon::log('Unexisting user \'' . Daemon::$config->user->value . '\', user not found. You have to replace config-variable \'user\' with existing username.');
$error = TRUE;
} elseif ($su['uid'] != posix_getuid() && posix_getuid() != 0) {
Daemon::log('You must have the root privileges to change user.');
$error = TRUE;
}
}
if (isset(Daemon::$config->minspareworkers->value) && isset(Daemon::$config->maxspareworkers->value)) {
if (Daemon::$config->minspareworkers->value > Daemon::$config->maxspareworkers->value) {
Daemon::log('\'minspareworkers\' cannot be greater than \'maxspareworkers\'.');
$error = TRUE;
}
}
if (isset(Daemon::$config->minworkers->value) && isset(Daemon::$config->maxworkers->value)) {
if (Daemon::$config->minworkers->value > Daemon::$config->maxworkers->value) {
Daemon::$config->minworkers->value = Daemon::$config->maxworkers->value;
}
}
if ($runmode == 'start') {
if ($error === FALSE) {
Daemon_Bootstrap::start();
}
} elseif ($runmode == 'status' || $runmode == 'fullstatus') {
$status = Daemon_Bootstrap::$pid && posix_kill(Daemon_Bootstrap::$pid, SIGTTIN);
echo '[STATUS] phpDaemon ' . Daemon::$version . ' is ' . ($status ? 'running' : 'NOT running') . ' (' . Daemon::$config->pidfile->value . ").\n";
if ($status && $runmode == 'fullstatus') {
echo 'Uptime: ' . Daemon::date_period_text(filemtime(Daemon::$config->pidfile->value), time()) . "\n";
Daemon::$shm_wstate = Daemon::shmop_open(Daemon::$config->pidfile->value, 0, 'wstate', FALSE);
$stat = Daemon::getStateOfWorkers();
echo "State of workers:\n";
echo "\tTotal: " . $stat['alive'] . "\n";
echo "\tIdle: " . $stat['idle'] . "\n";
echo "\tBusy: " . $stat['busy'] . "\n";
echo "\tShutdown: " . $stat['shutdown'] . "\n";
echo "\tPre-init: " . $stat['preinit'] . "\n";
echo "\tWait-init: " . $stat['waitinit'] . "\n";
echo "\tInit: " . $stat['init'] . "\n";
}
echo "\n";
} elseif ($runmode == 'update') {
if (!Daemon_Bootstrap::$pid || !posix_kill(Daemon_Bootstrap::$pid, SIGHUP)) {
echo '[UPDATE] ERROR. It seems that phpDaemon is not running' . (Daemon_Bootstrap::$pid ? ' (PID ' . Daemon_Bootstrap::$pid . ')' : '') . ".\n";
}
} elseif ($runmode == 'reopenlog') {
if (!Daemon_Bootstrap::$pid || !posix_kill(Daemon_Bootstrap::$pid, SIGUSR1)) {
echo '[REOPEN-LOG] ERROR. It seems that phpDaemon is not running' . (Daemon_Bootstrap::$pid ? ' (PID ' . Daemon_Bootstrap::$pid . ')' : '') . ".\n";
}
} elseif ($runmode == 'reload') {
if (!Daemon_Bootstrap::$pid || !posix_kill(Daemon_Bootstrap::$pid, SIGUSR2)) {
echo '[RELOAD] ERROR. It seems that phpDaemon is not running' . (Daemon_Bootstrap::$pid ? ' (PID ' . Daemon_Bootstrap::$pid . ')' : '') . ".\n";
}
} elseif ($runmode == 'restart') {
if ($error === FALSE) {
Daemon_Bootstrap::stop(2);
Daemon_Bootstrap::start();
}
} elseif ($runmode == 'hardrestart') {
Daemon_Bootstrap::stop(3);
Daemon_Bootstrap::start();
} elseif ($runmode == 'configtest') {
示例2: init
/**
* Performs initial actions.
* @return void
*/
public static function init()
{
Daemon::$startTime = time();
set_time_limit(0);
ob_start(array('Daemon', 'outputFilter'));
Daemon::checkSupports();
Daemon::$initservervar = $_SERVER;
Daemon::$masters = new ThreadCollection();
Daemon::$shm_wstate = Daemon::shmop_open(Daemon::$config->pidfile->value, Daemon::$shm_wstate_size, 'wstate');
Daemon::openLogs();
}
示例3: init
//.........这里部分代码省略.........
Daemon::log('You must have the root privileges to change group.');
$error = TRUE;
}
}
if (isset(Daemon::$settings['user']) && is_callable('posix_getuid')) {
if (($su = posix_getpwnam(Daemon::$settings['user'])) === FALSE) {
Daemon::log('Unexisting user \'' . Daemon::$settings['user'] . '\', user not found. You have to replace config-variable \'user\' with existing username.');
$error = TRUE;
} elseif ($su['uid'] != posix_getuid() && posix_getuid() != 0) {
Daemon::log('You must have the root privileges to change user.');
$error = TRUE;
}
}
if (isset(Daemon::$settings['minspareworkers']) && isset(Daemon::$settings['maxspareworkers'])) {
if (Daemon::$settings['minspareworkers'] > Daemon::$settings['maxspareworkers']) {
Daemon::log('\'minspareworkers\' cannot be greater than \'maxspareworkers\'.');
$error = TRUE;
}
}
if (isset(Daemon::$settings['minworkers']) && isset(Daemon::$settings['maxworkers'])) {
if (Daemon::$settings['minworkers'] > Daemon::$settings['maxworkers']) {
Daemon::$settings['maxworkers'] = Daemon::$settings['minworkers'];
}
}
if ($runmode == 'start') {
if ($error === FALSE) {
Daemon_Bootstrap::start();
}
} elseif ($runmode == 'status' or $runmode == 'fullstatus') {
$status = Daemon_Bootstrap::$pid && posix_kill(Daemon_Bootstrap::$pid, SIGTTIN);
echo '[STATUS] phpDaemon ' . Daemon::$version . ' is ' . ($status ? 'running' : 'NOT running') . ' (' . Daemon_Bootstrap::$pidfile . ").\n";
if ($status && $runmode == 'fullstatus') {
echo 'Uptime: ' . Daemon::date_period_text(filemtime(Daemon_Bootstrap::$pidfile), time()) . "\n";
Daemon::$shm_wstate = Daemon::shmop_open(Daemon::$settings['ipcwstate'], 0, 'wstate', FALSE);
$stat = Daemon::getStateOfWorkers();
echo "State of workers:\n";
echo "\tTotal: " . $stat['alive'] . "\n";
echo "\tIdle: " . $stat['idle'] . "\n";
echo "\tBusy: " . $stat['busy'] . "\n";
echo "\tShutdown: " . $stat['shutdown'] . "\n";
echo "\tPre-init: " . $stat['preinit'] . "\n";
echo "\tWait-init: " . $stat['waitinit'] . "\n";
echo "\tInit: " . $stat['init'] . "\n";
}
echo "\n";
} elseif ($runmode == 'update') {
if (!Daemon_Bootstrap::$pid || !posix_kill(Daemon_Bootstrap::$pid, SIGHUP)) {
echo '[UPDATE] ERROR. It seems that phpDaemon is not running' . (Daemon_Bootstrap::$pid ? ' (PID ' . Daemon_Bootstrap::$pid . ')' : '') . ".\n";
}
} elseif ($runmode == 'reopenlog') {
if (!Daemon_Bootstrap::$pid || !posix_kill(Daemon_Bootstrap::$pid, SIGUSR1)) {
echo '[REOPEN-LOG] ERROR. It seems that phpDaemon is not running' . (Daemon_Bootstrap::$pid ? ' (PID ' . Daemon_Bootstrap::$pid . ')' : '') . ".\n";
}
} elseif ($runmode == 'reload') {
if (!Daemon_Bootstrap::$pid || !posix_kill(Daemon_Bootstrap::$pid, SIGUSR2)) {
echo '[RELOAD] ERROR. It seems that phpDaemon is not running' . (Daemon_Bootstrap::$pid ? ' (PID ' . Daemon_Bootstrap::$pid . ')' : '') . ".\n";
}
} elseif ($runmode == 'restart') {
Daemon_Bootstrap::stop(2);
Daemon_Bootstrap::start();
} elseif ($runmode == 'hardrestart') {
Daemon_Bootstrap::stop(3);
Daemon_Bootstrap::start();
} elseif ($runmode == 'configtest') {
$term = new Terminal();
$term->enable_color = TRUE;
示例4: init
public static function init()
{
Daemon::$startTime = time();
set_time_limit(0);
ob_start(array('Daemon', 'outputFilter'));
Daemon::$initservervar = $_SERVER;
Daemon::$masters = new threadCollection();
Daemon::$shm_wstate = Daemon::shmop_open(Daemon::$settings['ipcwstate'], Daemon::$shm_wstate_size, 'wstate');
Daemon::openLogs();
}