Skip to content

Commit

Permalink
rpc 重启
Browse files Browse the repository at this point in the history
  • Loading branch information
东流 committed Dec 19, 2017
1 parent ee25afe commit 4755e84
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions App.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,31 @@ public function ServiceRun($params)

private function reloadSwoole($service,$env)
{

$config = DI::get('main');
$class = dirname(dirname(dirname(dirname(__FILE__)))).'/env/'.$env.'/main.ini';
$config = @parse_ini_file($class,true);

$name = $config['common']['application.service_name'];
if($name == ''){
return true;
}
if($service == '-t'){
}

if($service === '-t'){
$name = $name.'tcp';
$pid = exec('pidof'.' '.$name);
if($pid != ''){
exec("kill -TERM ".$pid);
sleep(1);
$app = new \ultraman\Tcp\SwooleServer();
}
}elseif($service === '-h'){
$pid = exec('pidof'.' '.$name);
if($pid !=''){
exec("kill -USR1 ".$pid);
}
}
$pid = exec('pidof'.' '.$name);
exec("kill -USR1 ".$pid);
die;
die;
}


Expand Down

0 comments on commit 4755e84

Please sign in to comment.