overflow_probe_container_ne.../main.go
crusader cc2c4e7d27 ing
2018-03-21 20:05:04 +09:00

50 lines
831 B
Go

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