From b36f1fd7d757e939959444c2b2cbceeeefe4cfa7 Mon Sep 17 00:00:00 2001 From: eleksir Date: Mon, 22 Apr 2024 23:05:07 +0300 Subject: [PATCH] Add sig{quit,term,int} handler that just quits application --- main.go | 5 ++++- signal.go | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index e90b1ff..8887e10 100644 --- a/main.go +++ b/main.go @@ -112,7 +112,10 @@ func main() { go sigHandler() signal.Notify(sigChan, syscall.SIGUSR1, - syscall.SIGUSR2) + syscall.SIGUSR2, + syscall.SIGQUIT, + syscall.SIGTERM, + syscall.SIGINT) // Populate memory stats if Conf.Mem.Enabled { diff --git a/signal.go b/signal.go index 5a36527..ea94087 100644 --- a/signal.go +++ b/signal.go @@ -25,6 +25,9 @@ func sigHandler() { UpdateReady <- true + case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT: + os.Exit(0) + // We have signal that we're not interested in, so make a new loop iteration. default: continue