add: 提交
This commit is contained in:
32
crontask/config_linux.go
Normal file
32
crontask/config_linux.go
Normal file
@@ -0,0 +1,32 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"ems.agt/lib/log"
|
||||
)
|
||||
|
||||
// 启动一个 goroutine 监听信号量
|
||||
func ReloadRoutine() {
|
||||
sigCh := make(chan os.Signal, 1)
|
||||
|
||||
signal.Notify(sigCh, syscall.SIGUSR1)
|
||||
|
||||
for {
|
||||
<-sigCh
|
||||
log.Info("Received reload signal, reloading config...")
|
||||
|
||||
err := ReadConfig(*ConfigFile)
|
||||
if err != nil {
|
||||
log.Error("Failed to ReadConfig:", err)
|
||||
continue
|
||||
}
|
||||
|
||||
log.Info("Config reloaded successfully.")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user