Add sig{quit,term,int} handler that just quits application
This commit is contained in:
5
main.go
5
main.go
@@ -112,7 +112,10 @@ func main() {
|
|||||||
go sigHandler()
|
go sigHandler()
|
||||||
signal.Notify(sigChan,
|
signal.Notify(sigChan,
|
||||||
syscall.SIGUSR1,
|
syscall.SIGUSR1,
|
||||||
syscall.SIGUSR2)
|
syscall.SIGUSR2,
|
||||||
|
syscall.SIGQUIT,
|
||||||
|
syscall.SIGTERM,
|
||||||
|
syscall.SIGINT)
|
||||||
|
|
||||||
// Populate memory stats
|
// Populate memory stats
|
||||||
if Conf.Mem.Enabled {
|
if Conf.Mem.Enabled {
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ func sigHandler() {
|
|||||||
|
|
||||||
UpdateReady <- true
|
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.
|
// We have signal that we're not interested in, so make a new loop iteration.
|
||||||
default:
|
default:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user