function StartServ($phpStart, $cmd, $name) { $process = new swoole_process(function (swoole_process $worker) use($name, $cmd, $phpStart) { //目前指支持一个 $worker->exec($phpStart, array(STARTBASEPATH . "/lib/Swoole/shell/start.php", $cmd, $name)); //拉起server StartLogTimer(__LINE__ . ' ' . $phpStart . ' ' . STARTBASEPATH . '/lib/Swoole/shell/start.php ' . $cmd . ' ' . $name); }, false); $pid = $process->start(); $exeRet = swoole_process::wait(); return; }
function StartServ($phpStart, $cmd, $name) { $process = new swoole_process(function (swoole_process $worker) use($name, $cmd, $phpStart) { //目前指支持一个 $worker->exec($phpStart, array(STARTBASEPATH . "/lib/Swoole/shell/start.php", $cmd, $name)); //拉起server StartLogTimer(__LINE__ . ' ' . $phpStart . ' ' . STARTBASEPATH . '/lib/Swoole/shell/start.php ' . $cmd . ' ' . $name); }, false); $pid = $process->start(); $exeRet = swoole_process::wait(); if ($exeRet['code']) { //创建失败 StartLog(" startall [31;40m [FAIL] [0m" . PHP_EOL); return false; } else { StartLog(" startall [31;40m [SUCCESS] [0m" . PHP_EOL); return true; } }