1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-03-14 14:54:58 +08:00
parent 66a529cec0
commit 8d3cc5239e
2 changed files with 11 additions and 7 deletions

View File

@ -50,6 +50,7 @@ func init() {
_signal_listen(m, 1, mdb.NAME, START, ice.CMD, "runtime")
_signal_listen(m, 2, mdb.NAME, RESTART, ice.CMD, "exit 1")
_signal_listen(m, 3, mdb.NAME, STOP, ice.CMD, "exit 0")
_signal_listen(m, int(syscall.SIGUSR1), mdb.NAME, "info", ice.CMD, "runtime")
}},
LISTEN: {Name: "listen signal name cmd", Help: "监听", Hand: func(m *ice.Message, arg ...string) {
_signal_listen(m, kit.Int(m.Option(SIGNAL)), arg...)

View File

@ -7,6 +7,7 @@ import (
"regexp"
"runtime"
"strings"
"syscall"
"time"
ice "shylinux.com/x/icebergs"
@ -171,14 +172,16 @@ func _dream_check(m *ice.Message, name string) string {
if pid := m.Cmdx(nfs.CAT, p, kit.Dict(ice.MSG_USERROLE, aaa.TECH)); pid != "" && nfs.Exists(m, "/proc/"+pid) {
m.Info("already exists %v", pid)
return ""
} else {
for i := 0; i < 3; i++ {
if m.Cmd(SPACE, name).Length() > 0 {
m.Info("already exists %v", name)
return ""
}
m.Sleep300ms()
} else if proc, err := os.FindProcess(kit.Int(pid)); err == nil && proc.Signal(syscall.SIGUSR1) == nil {
m.Info("already exists %v", pid)
return ""
}
for i := 0; i < 5; i++ {
if m.Cmd(SPACE, name).Length() > 0 {
m.Info("already exists %v", name)
return ""
}
m.Sleep300ms()
}
}
return p