diff --git a/cmd/agent/main.go b/cmd/agent/main.go index 30d396e..5c40207 100644 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -19,6 +19,7 @@ import ( "runtime" "sync" "sync/atomic" + "syscall" "time" "github.com/shirou/gopsutil/v3/cpu" @@ -63,7 +64,7 @@ func main() { var reportInterval = time.Duration(config.ReportInterval * 1000000000) c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt) + signal.Notify(c, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT) pollTicker := time.NewTicker(pollInterval) reportTicker := time.NewTicker(reportInterval) diff --git a/cmd/server/main.go b/cmd/server/main.go index 8529bec..43be822 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -45,7 +45,7 @@ func main() { } func Run(ctx context.Context) error { - ctx, cancel := signal.NotifyContext(ctx, syscall.SIGINT) + ctx, cancel := signal.NotifyContext(ctx, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT) defer cancel() go func() {