本文整理汇总了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();
?>