예제 #1
0
파일: myjob.go 프로젝트: rubytomato/rhw
func init() {
	revel.OnAppStart(func() {
		jobs.Schedule("0 */5 * ? * ?", MyJob{Name: "job1"})
		jobs.Schedule("cron.every_1h", MyJob{Name: "job2"})
		jobs.Schedule("cron.every_10m", MyJob{Name: "job3"})
		jobs.Schedule("@every 1m", jobs.Func(reminder))
		jobs.Now(MyJob{Name: "job Now"})
	})
}
예제 #2
0
//Init configuration
func (p *Project) Init(dir os.FileInfo) error {
	err := p.loadConf(dir.Name())
	if err == nil {
		for sys, time := range p.Configuration.AutoDeploySchedule {
			buildInstr := p.Configuration.BuildInstructions[sys]
			if buildInstr != nil {
				//Explicitly capture sys
				targetSys := sys
				jobs.Schedule(time, jobs.Func(func() {
					BMInstance().CreateOrReturnStatusBuild(p.Name, targetSys, "master", true)
				}))
			}
		}
	}
	return err
}