summaryrefslogtreecommitdiff
path: root/src/db.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-11-18 14:10:48 +0100
committerantirez <antirez@gmail.com>2011-11-18 14:10:48 +0100
commit4ab8695d537eff1dbc554bf3ab1896495311deda (patch)
tree35d0cf3e5bcc670492c0440261083492106d7b62 /src/db.c
parent5c85257b9615c050924f54b65b44ed54f49ac21d (diff)
downloadredis-4ab8695d537eff1dbc554bf3ab1896495311deda.tar.gz
New script timeout semantics and SCRIPT KILL implemented. SHUTDOWN NOSAVE and SHUTDOWN SAVE implemented.
Diffstat (limited to 'src/db.c')
-rw-r--r--src/db.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/db.c b/src/db.c
index 38983cb5a..3135795d8 100644
--- a/src/db.c
+++ b/src/db.c
@@ -328,8 +328,22 @@ void typeCommand(redisClient *c) {
}
void shutdownCommand(redisClient *c) {
- if (prepareForShutdown() == REDIS_OK)
- exit(0);
+ int flags = 0;
+
+ if (c->argc > 2) {
+ addReply(c,shared.syntaxerr);
+ return;
+ } else if (c->argc == 2) {
+ if (!strcasecmp(c->argv[1]->ptr,"nosave")) {
+ flags |= REDIS_SHUTDOWN_NOSAVE;
+ } else if (!strcasecmp(c->argv[1]->ptr,"save")) {
+ flags |= REDIS_SHUTDOWN_SAVE;
+ } else {
+ addReply(c,shared.syntaxerr);
+ return;
+ }
+ }
+ if (prepareForShutdown(flags) == REDIS_OK) exit(0);
addReplyError(c,"Errors trying to SHUTDOWN. Check logs.");
}