public function actionRestart() { //关闭进程 $this->actionStop(); //启动进程 $task = $this->taskName . '/run'; while ($this->try < $this->tryLimit) { $this->try++; $status = System::startByRoot(CRONTAB_ROOT . '/yii', $task, 1); if ($status) { echo $msg = "start {$task}", PHP_EOL; $this->log($msg); break; } } }
public function actionRestart() { echo "start restart..\n"; $task = 'manager/restart'; $num = System::getProcessNum($task); if ($num > 0) { return true; } while ($this->try < $this->tryLimit) { $this->try++; $status = System::startByRoot(CRONTAB_ROOT . '/yii', $task, 1); if ($status) { echo "restart {$task}\n"; break; } } echo "restarted..\n"; }