他の人も同じ問題を抱えています。この要点を参照してください。
デーモン化オプションがアクティブ化されると、Redisはプロセスがすでにデーモンであるかどうかをチェックしません(getppidへの呼び出しはありません)。体系的にフォークしますが、一度だけです。これはやや珍しいことです。他のデーモン化メカニズムでは、getppidの初期チェックとforkを2回(setsid呼び出しの前後)呼び出す必要がある場合がありますが、Linuxではこれは厳密には必要ありません。
デーモン化の詳細については、このFAQを参照してください。
Redisデーモン化機能は非常にシンプルです。
void daemonize(void) {
int fd;
if (fork() != 0) exit(0); /* parent exits */
setsid(); /* create a new session */
/* Every output goes to /dev/null. If Redis is daemonized but
* the 'logfile' is set to 'stdout' in the configuration file
* it will not log at all. */
if ((fd = open("/dev/null", O_RDWR, 0)) != -1) {
dup2(fd, STDIN_FILENO);
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
if (fd > STDERR_FILENO) close(fd);
}
}
Upstartのドキュメントには次のように書かれています。
expect daemon
Specifies that the job's main process is a daemon, and will fork twice after being run.
init(8) will follow this daemonisation, and will wait for this to occur before running
the job's post-start script or considering the job to be running.
Without this stanza init(8) is unable to supervise daemon processes and will
believe them to have stopped as soon as they daemonise on startup.
expect fork
Specifies that the job's main process will fork once after being run. init(8) will
follow this fork, and will wait for this to occur before running the job's post-start
script or considering the job to be running.
Without this stanza init(8) is unable to supervise forking processes and will believe
them to have stopped as soon as they fork on startup.
したがって、Redis側でデーモン化を非アクティブ化するか、upstart構成でexpectデーモンではなくexpectforkを使用しようとします。