add signal handle

master
dingjun 6 years ago
parent 560a38afcf
commit f04444c210

@ -4,6 +4,8 @@ import (
"flag" "flag"
"fmt" "fmt"
"os" "os"
"os/signal"
"syscall"
"github.com/fangdingjun/go-log" "github.com/fangdingjun/go-log"
) )
@ -53,6 +55,11 @@ func main() {
log.Debugf("%+v", cfg) log.Debugf("%+v", cfg)
makeServers(cfg) makeServers(cfg)
ch := make(chan os.Signal, 2)
select {} signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
select {
case s := <-ch:
log.Errorf("received signal %s, exit...", s)
}
log.Println("exit.")
} }

Loading…
Cancel
Save