diff --git a/main.go b/main.go index 13fa728..e8a996d 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,10 @@ import ( "io" "io/ioutil" "net" + "os" + "os/signal" "strings" + "syscall" glog "github.com/fangdingjun/go-log" proxyproto "github.com/pires/go-proxyproto" @@ -202,5 +205,11 @@ func main() { } }(l) } - select {} + + ch := make(chan os.Signal, 2) + signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) + select { + case s := <-ch: + glog.Printf("received signal %s, exit.", s) + } }