mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-27 22:49:40 -08:00
Merge pull request #361 from prometheus/handle-sigterm
Handle SIGTERM in addition to SIGINT.
This commit is contained in:
commit
a411a6bdea
5
main.go
5
main.go
|
@ -18,6 +18,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"sync"
|
"sync"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
@ -93,11 +94,11 @@ type prometheus struct {
|
||||||
|
|
||||||
func (p *prometheus) interruptHandler() {
|
func (p *prometheus) interruptHandler() {
|
||||||
notifier := make(chan os.Signal)
|
notifier := make(chan os.Signal)
|
||||||
signal.Notify(notifier, os.Interrupt)
|
signal.Notify(notifier, os.Interrupt, syscall.SIGTERM)
|
||||||
|
|
||||||
<-notifier
|
<-notifier
|
||||||
|
|
||||||
glog.Warning("Received SIGINT; Exiting gracefully...")
|
glog.Warning("Received SIGINT/SIGTERM; Exiting gracefully...")
|
||||||
p.close()
|
p.close()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue