mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Create PID file even if in foreground
Previously, Redis only wrote the pid file if it was daemonizing, but many times it's useful to have the pid written out even if you're in the foreground. Some background for this is: I usually run redis via daemontools. That entails running redis-server on the foreground. Given that, I'd also want redis-server to create a pidfile so other processes (e.g. nagios) can run checks for that. Closes #463
This commit is contained in:
parent
0d22121c27
commit
e6d499a446
@ -2374,7 +2374,7 @@ int prepareForShutdown(int flags) {
|
|||||||
return REDIS_ERR;
|
return REDIS_ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (server.daemonize) {
|
if (server.daemonize || server.pidfile) {
|
||||||
redisLog(REDIS_NOTICE,"Removing the pid file.");
|
redisLog(REDIS_NOTICE,"Removing the pid file.");
|
||||||
unlink(server.pidfile);
|
unlink(server.pidfile);
|
||||||
}
|
}
|
||||||
@ -3759,9 +3759,10 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
server.supervised = redisIsSupervised();
|
server.supervised = redisIsSupervised();
|
||||||
if (server.daemonize && server.supervised == 0) daemonize();
|
int background = server.daemonize && server.supervised == 0;
|
||||||
|
if (background) daemonize();
|
||||||
initServer();
|
initServer();
|
||||||
if (server.daemonize && server.supervised == 0) createPidFile();
|
if (background || server.pidfile) createPidFile();
|
||||||
redisSetProcTitle(argv[0]);
|
redisSetProcTitle(argv[0]);
|
||||||
redisAsciiArt();
|
redisAsciiArt();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user