Merge pull request #830 from yuce/827-sigterm

Handles SIGTERM signal; resolves #827
This commit is contained in:
Yuce Tekol 2017-09-14 16:52:52 +03:00 • committed by GitHub
commit 6993a395ae

View file

@ -21,6 +21,7 @@ import (
"os"
"os/signal"
"runtime/pprof"
"syscall"
"time"
"github.com/spf13/cobra"
@ -76,7 +77,7 @@ on the configured port.`,
// First SIGKILL causes server to shut down gracefully.
c := make(chan os.Signal, 2)
signal.Notify(c, os.Interrupt)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
select {
case sig := <-c:
logger.Printf("Received %s; gracefully shutting down...\n", sig.String())