MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / shutdownCommand

Function shutdownCommand

src/db.cpp:1454–1477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1452}
1453
1454void shutdownCommand(client *c) {
1455 int flags = 0;
1456
1457 if (c->argc > 2) {
1458 addReplyErrorObject(c,shared.syntaxerr);
1459 return;
1460 } else if (c->argc == 2) {
1461 if (!strcasecmp(szFromObj(c->argv[1]),"nosave")) {
1462 flags |= SHUTDOWN_NOSAVE;
1463 } else if (!strcasecmp(szFromObj(c->argv[1]),"save")) {
1464 flags |= SHUTDOWN_SAVE;
1465 } else if (!strcasecmp(szFromObj(c->argv[1]), "soft")) {
1466 g_pserver->soft_shutdown = true;
1467 serverLog(LL_WARNING, "Soft Shutdown Initiated");
1468 addReply(c, shared.ok);
1469 return;
1470 } else {
1471 addReplyErrorObject(c,shared.syntaxerr);
1472 return;
1473 }
1474 }
1475 if (prepareForShutdown(flags) == C_OK) throw ShutdownException();
1476 addReplyError(c,"Errors trying to SHUTDOWN. Check logs.");
1477}
1478
1479void renameGenericCommand(client *c, int nx) {
1480 robj *o;

Callers

nothing calls this directly

Calls 7

addReplyErrorObjectFunction · 0.85
szFromObjFunction · 0.85
serverLogFunction · 0.85
addReplyFunction · 0.85
prepareForShutdownFunction · 0.85
ShutdownExceptionClass · 0.85
addReplyErrorFunction · 0.85

Tested by

no test coverage detected