本文整理匯總了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);
}
}
示例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();
?>