當(dāng)我想停止一個進(jìn)程的時候, 使用參數(shù) stop, 結(jié)果 workermanlog一直在提示W(wǎng)orkerman not run... ,然后我就追蹤代碼,一直看到了這個位置。
$master_pid? ? ? = @file_get_contents(self::$pidFile);
$master_is_alive = $master_pid && @posix_kill($master_pid, 0);
?if ($master_is_alive) {
? ? ? ? ? ? if ($command === 'start') {
? ? ? ? ? ? ? ? self::log("Workerman already running...");
? ? ? ? ? ? ? ? exit;
? ? ? ? ? ? }
? ? ? ? } elseif ($command !== 'start' && $command !== 'restart' && $command !== 'kill') {
? ? ? ? ? ??
? ? ? ? ? ? self::log("Workerman not run...");
? ? ? ? ? ? exit;
? ? ? ? }
?
最后發(fā)現(xiàn)是 posix_kill($master_pid, 0)? 返回false?, 但明明是有這個master_pid , 而且使用 ps -ef grep? 也能看到這個workerman進(jìn)程。
是什么原因?qū)е路祷氐膄alse呢 ??posix_kill 這個函數(shù)有什么需要特別注意的地方嗎?