From 305662bfdd40bc48077f5441b066ed59b60f3ee7 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Wed, 14 Aug 2013 12:36:55 +0200 Subject: [PATCH] Handle SIGTERM in addition to SIGINT. Change-Id: I9c91ec7e2b9026b9eb152b98a6986f2bf773eb03 --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 018610688..06e8c6362 100644 --- a/main.go +++ b/main.go @@ -18,6 +18,7 @@ import ( "os" "os/signal" "sync" + "syscall" "time" "github.com/golang/glog" @@ -93,11 +94,11 @@ type prometheus struct { func (p *prometheus) interruptHandler() { notifier := make(chan os.Signal) - signal.Notify(notifier, os.Interrupt) + signal.Notify(notifier, os.Interrupt, syscall.SIGTERM) <-notifier - glog.Warning("Received SIGINT; Exiting gracefully...") + glog.Warning("Received SIGINT/SIGTERM; Exiting gracefully...") p.close() os.Exit(0) }