add signal handler

master
dingjun 6 years ago
parent 10850b7f92
commit 96e0332d16

@ -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)
}
}

Loading…
Cancel
Save