mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix: if server recive kill-signal before being running-state, server will can't be killed graceful
Signed-off-by: Victor1319 <834863182@qq.com>
This commit is contained in:
parent
8cd1d1c9cd
commit
1ba42ac7d3
10
cmd/cmd.go
10
cmd/cmd.go
@ -90,9 +90,11 @@ func interceptSignal(s common.Server) {
|
||||
signal.Notify(sigC, syscall.SIGINT, syscall.SIGTERM)
|
||||
syslog.Println("action[interceptSignal] register system signal.")
|
||||
go func() {
|
||||
sig := <-sigC
|
||||
syslog.Printf("action[interceptSignal] received signal: %s.", sig.String())
|
||||
s.Shutdown()
|
||||
for {
|
||||
sig := <-sigC
|
||||
syslog.Printf("action[interceptSignal] received signal: %s. pid %d", sig.String(), os.Getpid())
|
||||
s.Shutdown()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@ -278,6 +280,8 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
syslog.Printf("server start success, pid %d, role %s", os.Getpid(), role)
|
||||
|
||||
err = log.OutputPid(logDir, role)
|
||||
if err != nil {
|
||||
log.LogFlush()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user