50 lines
831 B
Go
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()
|
|
|
|
}
|