增加 pid文件进程感知

This commit is contained in:
dengsgo
2020-06-27 15:11:55 +08:00
parent 7c6f8f910b
commit c5f0649ab5
2 changed files with 15 additions and 0 deletions

View File

@@ -48,3 +48,9 @@ func stopDaemon() error {
os.Remove(getPidFile())
return nil
}
func stopSelf() {
pid := os.Getpid()
os.Remove(getPidFile())
_ = exec.Command("kill", strconv.Itoa(pid)).Run()
}