aboutsummaryrefslogtreecommitdiffstats
path: root/configd/src/apps/sentinel/rpchooks.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'configd/src/apps/sentinel/rpchooks.cpp')
-rw-r--r--configd/src/apps/sentinel/rpchooks.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/configd/src/apps/sentinel/rpchooks.cpp b/configd/src/apps/sentinel/rpchooks.cpp
index 6e271db3977..99bcd404402 100644
--- a/configd/src/apps/sentinel/rpchooks.cpp
+++ b/configd/src/apps/sentinel/rpchooks.cpp
@@ -23,13 +23,17 @@ RPCHooks::initRPC(FRT_Supervisor *supervisor)
rb.MethodDesc("list services");
rb.ReturnDesc("status", "Status for services");
//-------------------------------------------------------------------------
+ rb.DefineMethod("sentinel.service.restart", "s", "",
+ FRT_METHOD(RPCHooks::rpc_restartService), this);
+ rb.MethodDesc("restart a service");
+ //-------------------------------------------------------------------------
rb.DefineMethod("sentinel.service.stop", "s", "",
FRT_METHOD(RPCHooks::rpc_stopService), this);
rb.MethodDesc("stop a service");
//-------------------------------------------------------------------------
rb.DefineMethod("sentinel.service.start", "s", "",
FRT_METHOD(RPCHooks::rpc_startService), this);
- rb.MethodDesc("stop a service");
+ rb.MethodDesc("start a service");
//-------------------------------------------------------------------------
}
@@ -42,6 +46,16 @@ RPCHooks::rpc_listServices(FRT_RPCRequest *req)
}
void
+RPCHooks::rpc_restartService(FRT_RPCRequest *req)
+{
+ FRT_Values &args = *req->GetParams();
+ const char *srvNM = args[0]._string._str;
+ LOG(debug, "got restartservice '%s'", srvNM);
+ req->Detach();
+ _commands.enqueue(std::make_unique<Cmd>(req, Cmd::RESTART, srvNM));
+}
+
+void
RPCHooks::rpc_stopService(FRT_RPCRequest *req)
{
FRT_Values &args = *req->GetParams();