示例#1
0
文件: ism.go 项目: helloyokoy/gserver
func main() {
	parseFlag()

	if showVersion {
		fmt.Printf("version %s\n", "1.0.0")
		os.Exit(0)
	}

	//
	outputPid()

	l, err := ilog.InitLog("log")
	if err != nil {
		log.Fatalf("listen failed! [%s]", err.Error())
	}

	go signalHandle(l)

	if toProfile {
		prof.StartProf()
	}

	if err := config.Start(sConfigPath); err != nil {
		ilog.Printf("config start failed![%s]", err.Error())
	}

	if err := data.Start(); err != nil {
		ilog.Printf("data start failed![%s]", err.Error())
	}

	if err := monitor.Start(); err != nil {
		ilog.Printf("monitor start failed![%s]", err.Error())
	}

	if err := web.Start(); err != nil {
		ilog.Printf("web start failed![%s]", err.Error())
	}

	os.Exit(0)
}
func main() {
	checkUsage()

	if os.Args[1] == "generate" {
		config.Generate()
		os.Exit(0)
	} else {
		this_config, err := config.Load(os.Args[1])

		if err != nil {
			fmt.Println("Error while loading config file:", err)
			os.Exit(1)
		}

		log := logger.Init(this_config.Facility, this_config.LogLevel)

		result := web.Start(this_config.Listen, this_config, log)

		log.Log("crit", fmt.Sprintf("Failed to start: %s", result))
		log.Close()
	}
}
示例#3
0
文件: main.go 项目: kelixin/rtg
func main() {
	web.Start()
}