后臺管理界面,增減進程后重啟整個服務
<?php
if (PHP_SAPI !== 'cli') {
exit("You must run the CLI environment\n");
}
$rootPath = dirname(__DIR__);
$restartFile = $rootPath . '/runtime/restart.crontab';
if (is_file($restartFile) && unlink($restartFile)) {
$cmd = 'cd ' . $rootPath . ' && php start.php restart -d';
shell_exec($cmd);
sleep(3);
}
利用Linux的定時任務,每分鐘調(diào)用一次這個腳本;
腳本通過 is_file($restartFile) && unlink($restartFile),檢查標志文件,重啟整個服務。