add Dockerfile and run.sh

main
Administrator 2024-05-01 18:50:21 +08:00
parent f60e658965
commit 23ca747cb9
1 changed files with 1 additions and 2 deletions

View File

@ -14,14 +14,13 @@ var maxRetries = 3
func main() { func main() {
now := time.Now() now := time.Now()
nowDate := now.Format("2006-01-02 15:04:05") + " " + now.Weekday().String() nowDate := now.Format("2006-01-02 15:04:05") + " " + now.Weekday().String()
log.Printf("等待执行定时任务中...当前时间是:%s", nowDate) log.Printf("等待执行定时任务中...当前时间是:%s", nowDate)
if maxRetries != 0 { if maxRetries != 0 {
// 定义任务,每周五的五点执行 // 定义任务,每周五的五点执行
gocron.Every(1).Friday().At("17:00").Do(job) gocron.Every(1).Friday().At("17:00").Do(job)
// 开始定时任务 // 开始定时任务
<-gocron.Start() <-gocron.Start()
} else { } else {
log.Fatalln("最大重试次数已到达3退出") log.Fatalln("最大重试次数已到达3退出")
} }