Browse Source

Graceful shutdown on SIGTERM, too

Ask Bjørn Hansen 2 years ago
parent
commit
75951ac210
1 changed files with 2 additions and 1 deletions
  1. 2 1
      geodns.go

+ 2 - 1
geodns.go

@@ -28,6 +28,7 @@ import (
 	"runtime"
 	"runtime"
 	"runtime/pprof"
 	"runtime/pprof"
 	"strings"
 	"strings"
+	"syscall"
 	"time"
 	"time"
 
 
 	"github.com/abh/geodns/v3/applog"
 	"github.com/abh/geodns/v3/applog"
@@ -152,7 +153,7 @@ func main() {
 
 
 	log.Printf("Starting geodns %s (%s)\n", VERSION, runtime.Version())
 	log.Printf("Starting geodns %s (%s)\n", VERSION, runtime.Version())
 
 
-	ctx, _ := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)
+	ctx, _ := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill, syscall.SIGTERM)
 	g, ctx := errgroup.WithContext(ctx)
 	g, ctx := errgroup.WithContext(ctx)
 
 
 	g.Go(func() error {
 	g.Go(func() error {