]> git.saurik.com Git - redis.git/blobdiff - src/db.c
List connected slaves with ip,port,state information in INFO, as requested by github...
[redis.git] / src / db.c
index 38983cb5a9d66ce331ee9226ef967ec6e83412fc..3135795d8e8ae9f496278c4057f9d02350af00f1 100644 (file)
--- 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.");
 }