Handle SIGTERM in addition to SIGINT.

Change-Id: I9c91ec7e2b9026b9eb152b98a6986f2bf773eb03
This commit is contained in:
Julius Volz 2013-08-14 12:36:55 +02:00
parent 972e856d9b
commit 305662bfdd
1 changed files with 3 additions and 2 deletions

View File

@ -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)
}