Check if the daemon pid file can be written
This commit is contained in:
parent
49819b64db
commit
8827d4c142
|
@ -163,9 +163,15 @@ if (!$foreground) {
|
||||||
exit(1);
|
exit(1);
|
||||||
} elseif ($pid) {
|
} elseif ($pid) {
|
||||||
// The parent process continues here
|
// The parent process continues here
|
||||||
|
file_put_contents($pidfile, $pid);
|
||||||
|
if (!is_readable($pidfile)) {
|
||||||
|
echo "Pid file wasn't written.\n";
|
||||||
|
Logger::warning('Could not store pid file');
|
||||||
|
posix_kill($pid, SIGTERM);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
echo 'Child process started with pid ' . $pid . ".\n";
|
echo 'Child process started with pid ' . $pid . ".\n";
|
||||||
Logger::notice('Child process started', ['pid' => $pid]);
|
Logger::notice('Child process started', ['pid' => $pid]);
|
||||||
file_put_contents($pidfile, $pid);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user