From 6502ec8f144fcfaa5c560f64077d48671e4718b0 Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Tue, 12 Jun 2018 16:44:04 -0700 Subject: [PATCH] Treat sigterm as a clean shutdown signal (#4277) --- cmd/telegraf/telegraf.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/telegraf/telegraf.go b/cmd/telegraf/telegraf.go index b21f223cf..57ff846cf 100644 --- a/cmd/telegraf/telegraf.go +++ b/cmd/telegraf/telegraf.go @@ -147,11 +147,11 @@ func reloadLoop( shutdown := make(chan struct{}) signals := make(chan os.Signal) - signal.Notify(signals, os.Interrupt, syscall.SIGHUP) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGTERM) go func() { select { case sig := <-signals: - if sig == os.Interrupt { + if sig == os.Interrupt || sig == syscall.SIGTERM { close(shutdown) } if sig == syscall.SIGHUP {