$content"); fclose($file); return intval($content); } function daemon(array $info): void { $pid = getPid($info['pidFile']); if ($pid == -1 or !isPid($pid)) { // pid not found logging::warning('Catch ' . $info['name'] . ' exit'); new Process($info['command']); logging::info('Restart ' . $info['name'] . ' success'); } } #[NoReturn] function subExit(string $nginxPid, string $phpFpmPid, string $vlmcsdPid): void { $nginxPid = getPid($nginxPid); logging::info("Sending kill signal to nginx ($nginxPid)"); posix_kill($nginxPid, SIGTERM); $phpFpmPid = getPid($phpFpmPid); logging::info("Sending kill signal to php-fpm ($phpFpmPid)"); posix_kill($phpFpmPid, SIGTERM); $vlmcsdPid = getPid($vlmcsdPid); logging::info("Sending kill signal to vlmcsd ($vlmcsdPid)"); posix_kill($vlmcsdPid, SIGTERM); logging::info('Waiting sub process exit...'); pcntl_wait($status); // wait all process exit logging::info('All process exit, Goodbye!'); exit; }