overflow_probe_container_ne.../main.go

50 lines
831 B
Go
Raw Normal View History

2017-12-04 11:59:11 +00:00
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"git.loafle.net/commons_go/logging"
2018-03-21 11:05:04 +00:00
oocc "git.loafle.net/overflow/overflow_commons_go/config"
2017-12-04 11:59:11 +00:00
"git.loafle.net/overflow/overflow_probe_container_network/server"
)
var (
2018-03-21 11:05:04 +00:00
pidPath *string
logConfigPath *string
2017-12-04 11:59:11 +00:00
)
func init() {
2018-03-21 11:05:04 +00:00
pidPath = oocc.FlagPidFilePath("./dist/network.pid")
logConfigPath = oocc.FlagLogConfigFilePath("")
2017-12-04 11:59:11 +00:00
flag.Parse()
2018-03-21 11:05:04 +00:00
logging.InitializeLogger(*logConfigPath)
2017-12-04 11:59:11 +00:00
}
func main() {
defer logging.Logger().Sync()
2017-12-14 08:51:08 +00:00
s := server.New(*pidPath)
2017-12-04 11:59:11 +00:00
go func() {
if err := s.Start(); nil != err {
2018-03-21 11:05:04 +00:00
logging.Logger().Infof("Server: Start error %v", err)
2017-12-04 11:59:11 +00:00
return
}
}()
2018-03-21 11:05:04 +00:00
stop := make(chan os.Signal)
signal.Notify(stop, syscall.SIGINT)
select {
case signal := <-stop:
logging.Logger().Infof("Got signal: %v\n", signal)
}
2017-12-04 11:59:11 +00:00
s.Stop()
}