func Run() { cfg.Load() sheepCfgLs := cfg.LoadConfigFile() log4go.New(cfg.LOGPATH) log4go.Logger.Printf("[SYSTEM]START SYSTEM INIT.") maxProcs := runtime.NumCPU() log4go.Logger.Printf("[SYSTEM]CPU NUM: %d ", maxProcs) runtime.GOMAXPROCS(maxProcs) log4go.Logger.Printf("[SYSTEM]MAX GOROUTINE: %d ", maxProcs) SignalHandle.StartSignalHandle("interrupt", exit.Now, true) log4go.Logger.Printf("[SYSTEM]FINISH SYSTEM INIT.") //add sheep log4go.Logger.Printf("[INFO]Start Loading sheeps .") for _, sheepCfg := range sheepCfgLs { sheep.SHEEPS[sheepCfg.NAME] = sheep.New(sheepCfg) } log4go.Logger.Printf("[INFO]Load sheeps success .") // log4go.Logger.Printf("[INFO]Start Yell .") exit.ALL.Add(1) go yell.Start() exit.ALL.Add(1) go http.Start() exit.ALL.Wait() }
func Run() { dog_cfg.Load() log4go.New(*dog_cfg.LOGPATH) log4go.Logger.Printf("[SYSTEM]START SYSTEM INIT.") maxProcs := runtime.NumCPU() log4go.Logger.Printf("[SYSTEM]CPU NUM: %d ", maxProcs) runtime.GOMAXPROCS(maxProcs) log4go.Logger.Printf("[SYSTEM]MAX GOROUTINE: %d ", maxProcs) SignalHandle.StartSignalHandle("interrupt", exit.Now, true) log4go.Logger.Printf("[SYSTEM]FINISH SYSTEM INIT.") URL := fmt.Sprintf("%s:%d", *dog_cfg.HOST, *dog_cfg.PORT) go protocol.StartShepherdDog(URL, *dog_cfg.SCRIPT) <-exit.SAFE }
func TestHeartbeat(t *testing.T) { cfg.Load() log4go.New(*cfg.LOGPATH) shep := sheep.New("test", "192.168.33.81", 12981) shep.Heatbeat() }