Commit 06862162 authored by chenchuanwen's avatar chenchuanwen

bridgestart

parent 5b37a670
......@@ -8,8 +8,6 @@
define("APPLICATION_PATH", realpath(dirname(__FILE__) . '/../../../')); //指向public的上一级
require_once APPLICATION_PATH . '/scripts/crontab/common.php';
$conf = \Yaf\Registry::get('config')->get('redis.database.params');
$http = new swoole_http_server("0.0.0.0", 9501);
$http->on('request', function ($request, $response) {
try{
......
......@@ -3,7 +3,7 @@ define("APPLICATION_PATH", realpath(dirname(__FILE__) . '/../../../')); //指向
require APPLICATION_PATH . '/scripts/crontab/baseCli.php';
require APPLICATION_PATH . '/scripts/crontab/common.php';
error_reporting(E_ALL ^ E_NOTICE);
class runRedisPush
class bridgeStart
{
/* config */
const LISTEN = "tcp://192.168.2.15:5555";
......@@ -42,6 +42,10 @@ class runRedisPush
return (getmypid());
}
}
public function callback($instance,$channelName,$message){
$orderService=\Business\Order\OrderServiceModel::getInstance();
$orderService->testPush($message);
}
protected function status(){
if (file_exists($this->pidfile)) {
$pid = file_get_contents($this->pidfile);
......@@ -50,13 +54,10 @@ class runRedisPush
printf("%s haven't running\n", $this->argv[0]);
}
}
public function callback($instance,$channelName,$message){
$orderService=\Business\Order\OrderServiceModel::getInstance();
$orderService->testPush($message);
}
private function start()
{
$pid = $this->daemon();
$conf = \Yaf\Registry::get('config')->get('redis.database.params');
$http = new swoole_http_server("0.0.0.0", 9501);
$http->on('request', function ($request, $response) {
try{
......@@ -93,6 +94,13 @@ class runRedisPush
$http->start();
}
private function reload(){
if (file_exists($this->pidfile)) {
$pid = file_get_contents($this->pidfile);
//posix_kill(posix_getpid(), SIGHUP);
posix_kill($pid, SIGHUP);
}
}
protected function restart(){
$this->stop();
$this->start();
......@@ -112,9 +120,10 @@ class runRedisPush
{
printf("%s start | stop | help | restart | reload \n", $proc);
}
private $argv;
public function main($argv)
{
$this->argv=$argv;
if (count($argv) < 2) {
printf("please input help parameter\n");
exit();
......@@ -126,11 +135,16 @@ class runRedisPush
$this->start();
} else if($argv[1] === 'restart'){
$this->restart();
}else{
}else if($argv[1] === 'status'){
$this->status();
}else if($argv[1]==='reload'){
$this->reload();
}
else{
$this->help($argv[0]);
}
}
}
$cgse = new runRedisPush();
$cgse = new bridgeStart();
$cgse->main($argv);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment