You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
841 B
41 lines
841 B
package main |
|
|
|
import ( |
|
"flag" |
|
"os" |
|
"os/signal" |
|
"syscall" |
|
"time" |
|
|
|
"go-common/app/interface/openplatform/monitor-end/conf" |
|
"go-common/app/interface/openplatform/monitor-end/http" |
|
"go-common/app/interface/openplatform/monitor-end/service" |
|
"go-common/library/log" |
|
"go-common/library/net/trace" |
|
) |
|
|
|
func main() { |
|
flag.Parse() |
|
conf.Init() |
|
log.Init(conf.Conf.Log) |
|
defer log.Close() |
|
trace.Init(nil) |
|
defer trace.Close() |
|
svr := service.New(conf.Conf) |
|
defer svr.Close() |
|
http.Init(conf.Conf, svr) |
|
c := make(chan os.Signal, 1) |
|
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) |
|
for { |
|
s := <-c |
|
switch s { |
|
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGSTOP, syscall.SIGINT: |
|
time.Sleep(time.Second) // 休眠1s |
|
return |
|
case syscall.SIGHUP: |
|
// TODO reload |
|
default: |
|
return |
|
} |
|
} |
|
}
|
|
|