示例#1
0
文件: main.go 项目: lucmichalski/fae
func main() {
	defer func() {
		if err := recover(); err != nil {
			fmt.Println(err)
			debug.PrintStack()
		}
	}()

	s := server.NewServer("configd")
	s.LoadConfig(options.configFile)
	s.Launch()

	go server.RunSysStats(s.StartedAt,
		time.Minute*time.Duration(options.statsInterval))

	monitorForever(s.Conf)
}
示例#2
0
文件: main.go 项目: lucmichalski/fae
func main() {
	defer func() {
		cleanup()

		if err := recover(); err != nil {
			fmt.Println(err)
			debug.PrintStack()
		}
	}()

	if options.cpuprof || options.memprof {
		cf := &profiler.Config{
			Quiet:        true,
			ProfilePath:  "prof",
			CPUProfile:   options.cpuprof,
			MemProfile:   options.memprof,
			BlockProfile: options.blockprof,
		}

		defer profiler.Start(cf).Stop()
	}

	log.Info("%s", `
     ____      __      ____ 
    ( ___)    /__\    ( ___)
     )__)    /(__)\    )__) 
    (__)    (__)(__)  (____)`)

	s := server.NewServer("fae")
	s.LoadConfig(options.configFile)
	s.Launch()

	go server.RunSysStats(time.Now(), options.tick)

	engineRunner = engine.NewEngine()
	signal.RegisterSignalHandler(syscall.SIGINT, func(sig os.Signal) {
		shutdown()
		engineRunner.StopRpcServe()
	})

	engineRunner.LoadConfig(s.Conf).
		ServeForever()
}