提交 fe23db3a 编写于 作者: Z zhong_ning

fix doreset cmd

Signed-off-by: Nzhong_ning <zhong_ning@hoperun.com>
上级 0ef2b548
...@@ -208,9 +208,21 @@ static void DoStop(const struct CmdArgs *ctx, const char *cmdContent) ...@@ -208,9 +208,21 @@ static void DoStop(const struct CmdArgs *ctx, const char *cmdContent)
static void DoReset(const struct CmdArgs *ctx, const char *cmdContent) static void DoReset(const struct CmdArgs *ctx, const char *cmdContent)
{ {
UNUSED(ctx); UNUSED(ctx);
INIT_LOGD("DoReset %s", cmdContent); INIT_LOGE("DoReset %s", cmdContent);
DoStop(ctx, cmdContent); Service *service = GetServiceByName(cmdContent);
DoStart(ctx, cmdContent); if (service == NULL) {
INIT_LOGE("Reset cmd cannot find service %s.", cmdContent);
return;
}
if (service->pid > 0) {
if (kill(service->pid, SIGKILL) != 0) {
INIT_LOGE("stop service %s pid %d failed! err %d.", service->name, service->pid, errno);
return;
}
} else {
StartServiceByName(cmdContent, false);
}
return;
} }
static void DoCopy(const struct CmdArgs *ctx, const char *cmdContent) static void DoCopy(const struct CmdArgs *ctx, const char *cmdContent)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册