Browse Source

add notify channel when exit

pull/297/head
xuzhiwei 4 years ago
parent
commit
631005a40c
  1. 7
      main.go

7
main.go

@ -15,7 +15,9 @@ import (
"net/http/httputil" "net/http/httputil"
"net/url" "net/url"
"os" "os"
"os/signal"
"strings" "strings"
"syscall"
"github.com/dtm-labs/dtm/dtmcli/logger" "github.com/dtm-labs/dtm/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmsvr/config" "github.com/dtm-labs/dtm/dtmsvr/config"
@ -31,7 +33,10 @@ func main() {
app, conf := entry.Main(&Version) app, conf := entry.Main(&Version)
if app != nil { if app != nil {
addAdmin(app, conf) addAdmin(app, conf)
select {} q := make(chan os.Signal)
signal.Notify(q, syscall.SIGINT, syscall.SIGTERM)
<-q
logger.Infof("Shutdown dtm server...")
} }
} }

Loading…
Cancel
Save