diff options
author | Arne Juul <arnej@yahoo-inc.com> | 2019-03-11 11:19:41 +0000 |
---|---|---|
committer | Arne Juul <arnej@yahoo-inc.com> | 2019-03-11 11:19:41 +0000 |
commit | f9c2e2629cdf04b9a643f27c3583086b5c6e60d7 (patch) | |
tree | 26398e2d57d01d694f6abb1e964f9eefb41593f7 /configd/src/apps/sentinel/rpchooks.cpp | |
parent | 48ce50681ad29a1a17446dbb1f0413615ca35725 (diff) |
add "restart" hooks
Diffstat (limited to 'configd/src/apps/sentinel/rpchooks.cpp')
-rw-r--r-- | configd/src/apps/sentinel/rpchooks.cpp | 16 |
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(); |