Beispiel #1
0
// 运行任务
func (self *Logic) Run() {
	// 确保开启报告
	self.LogGoOn()
	self.finish = make(chan bool)
	self.finishOnce = sync.Once{}
	// 重置计数
	self.sum[0], self.sum[1] = 0, 0
	// 重置计时
	self.takeTime = 0
	// 任务执行
	self.setStatus(status.RUN)
	switch self.AppConf.Mode {
	case status.OFFLINE:
		self.offline()
	case status.SERVER:
		self.server()
	case status.CLIENT:
		self.client()
	default:
		return
	}
	<-self.finish
	scheduler.TryFlushHistory()
	self.setStatus(status.STOPPED)
}
Beispiel #2
0
func run(which string) {
	exec.Command("/bin/sh", "-c", "title", config.APP_FULL_NAME).Start()
	defer func() {
		scheduler.TryFlushHistory()
	}()

	// 选择运行界面
	switch which {
	case "cmd":
		cmd.Run()

	case "web":
		fallthrough
	default:
		ctrl := make(chan os.Signal, 1)
		signal.Notify(ctrl, os.Interrupt, os.Kill)
		go web.Run()
		<-ctrl
	}
}