當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Daemon::shm_wstate方法代碼示例

本文整理匯總了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') {
開發者ID:J3FF3,項目名稱:phpdaemon,代碼行數:67,代碼來源:Daemon_Bootstrap.php

示例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();
 }
開發者ID:J3FF3,項目名稱:phpdaemon,代碼行數:15,代碼來源:Daemon.php

示例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;
開發者ID:svcorp77,項目名稱:phpdaemon,代碼行數:67,代碼來源:Daemon_Bootstrap.class.php

示例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();
 }
開發者ID:svcorp77,項目名稱:phpdaemon,代碼行數:10,代碼來源:Daemon.class.php


注:本文中的Daemon::shm_wstate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。