Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Lei Li
public
Commits
f08bac90
Commit
f08bac90
authored
Oct 17, 2024
by
Lei Li
Browse files
feat: 提供kill子进程的接口
parent
544ad0ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/monitor_daemon/monitor_daemon.go
View file @
f08bac90
...
@@ -288,7 +288,7 @@ func (m *MonitorDaemon) runWithSignal(sigs []os.Signal) {
...
@@ -288,7 +288,7 @@ func (m *MonitorDaemon) runWithSignal(sigs []os.Signal) {
if
isAlive
&&
m
.
isProcAbnormalCallback
!=
nil
{
if
isAlive
&&
m
.
isProcAbnormalCallback
!=
nil
{
isAbnormal
:=
m
.
isProcAbnormalCallback
()
isAbnormal
:=
m
.
isProcAbnormalCallback
()
if
isAbnormal
{
if
isAbnormal
{
m
.
k
illProcess
()
m
.
K
illProcess
()
}
}
}
}
...
@@ -297,7 +297,7 @@ func (m *MonitorDaemon) runWithSignal(sigs []os.Signal) {
...
@@ -297,7 +297,7 @@ func (m *MonitorDaemon) runWithSignal(sigs []os.Signal) {
}
}
}
}
func
(
m
*
MonitorDaemon
)
k
illProcess
()
{
func
(
m
*
MonitorDaemon
)
K
illProcess
()
{
pid
:=
m
.
childPid
pid
:=
m
.
childPid
if
pid
!=
0
{
if
pid
!=
0
{
childExec
:=
getProcExec
(
fmt
.
Sprintf
(
"%d"
,
pid
))
childExec
:=
getProcExec
(
fmt
.
Sprintf
(
"%d"
,
pid
))
...
@@ -314,7 +314,7 @@ func (m *MonitorDaemon) killProcess() {
...
@@ -314,7 +314,7 @@ func (m *MonitorDaemon) killProcess() {
l
.
Errorf
(
"killProcess child process kill SIGTERM error: %v"
,
err
)
l
.
Errorf
(
"killProcess child process kill SIGTERM error: %v"
,
err
)
}
}
}
else
{
}
else
{
l
.
Error
f
(
"killProcess child process exec is not exist, pid: %d, exec:%s, cmdline: %s"
,
m
.
childPid
,
childExec
,
m
.
cmdline
)
l
.
Warn
f
(
"killProcess child process exec is not exist, pid: %d, exec:%s, cmdline: %s"
,
m
.
childPid
,
childExec
,
m
.
cmdline
)
}
}
}
else
{
}
else
{
l
.
Errorf
(
"killProcess child process pid is not exist, pid: %d, cmdline: %s"
,
m
.
childPid
,
m
.
cmdline
)
l
.
Errorf
(
"killProcess child process pid is not exist, pid: %d, cmdline: %s"
,
m
.
childPid
,
m
.
cmdline
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment