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


PHP Daemon::start方法代碼示例

本文整理匯總了PHP中Daemon::start方法的典型用法代碼示例。如果您正苦於以下問題:PHP Daemon::start方法的具體用法?PHP Daemon::start怎麽用?PHP Daemon::start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Daemon的用法示例。


在下文中一共展示了Daemon::start方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: parseArgs

 /**
  * Parses command line arguments
  * @param Daemon $d
  */
 public static function parseArgs(Daemon $d)
 {
     global $argc, $argv;
     if (php_sapi_name() != 'cli') {
         return;
     }
     if ($argc == 2) {
         switch ($argv[1]) {
             case 'start':
                 $d->start();
                 break;
             case 'stop':
                 $d->stop();
                 break;
             case 'restart':
                 $d->restart();
                 break;
             case 'status':
                 $status = $d->status();
                 echo static::getDaemonName($d) . " is" . ($status ? " " : " not ") . "running\n";
                 break;
             default:
                 echo "Unknown command " . $argv[1] . "\n";
                 exit(2);
         }
         exit;
     } else {
         echo sprintf("usage: %s start|stop|restart|status", $argv[0]);
         exit(2);
     }
 }
開發者ID:vvondra,項目名稱:php-daemon,代碼行數:35,代碼來源:Daemon.php

示例2: RatingEngine

require('/etc/cdrtool/global.inc');
require('cdr_generic.php');
require('rating.php');
require('rating_server.php');

// Init Rating Engine
syslog(LOG_NOTICE,"Starting CDRTool Rating Engine...");

$RatingEngineServer = new RatingEngine();

if (!$RatingEngineServer->init_ok) {
    syslog(LOG_NOTICE,'Error: Cannot start Rating Engine, fix the errors and try again');
    exit;
}

syslog(LOG_NOTICE,"Rating Engine started sucesfully, going to background...");

// Go to the background
$d = new Daemon('/var/run/ratingEngine.pid');
$d->start();

$daemon = new socketDaemon();
$server = $daemon->create_server('ratingEngineServer', 'ratingEngineClient', $RatingEngine['socketIP'], $RatingEngine['socketPort']);

syslog(LOG_NOTICE,"Rating Engine is now ready to serve network requests");

$daemon->process();

?>
開發者ID:AGProjects,項目名稱:cdrtool,代碼行數:29,代碼來源:ratingEngine.php


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