mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-02 14:00:27 +08:00
优化节点停止逻辑
This commit is contained in:
@@ -213,7 +213,16 @@ func (this *AppCmd) runStop() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _ = this.sock.Send(&gosock.Command{Code: "stop"})
|
// 从systemd中停止
|
||||||
|
if runtime.GOOS == "linux" {
|
||||||
|
systemctl, _ := exec.LookPath("systemctl")
|
||||||
|
if len(systemctl) > 0 {
|
||||||
|
_ = exec.Command(systemctl, "stop", teaconst.SystemdServiceName).Run()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果仍在运行,则发送停止指令
|
||||||
|
_, _ = this.sock.SendTimeout(&gosock.Command{Code: "stop"}, 1*time.Second)
|
||||||
|
|
||||||
fmt.Println(this.product+" stopped ok, pid:", types.String(pid))
|
fmt.Println(this.product+" stopped ok, pid:", types.String(pid))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user