Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cobra.Command{ Use: "cron", Short: "Timing request and sending system notification\n", Long: `Timing request and sending system notification`, RunE: func(cmd *cobra.Command, args []string) error { lockfile := fmt.Sprintf(LockFileTemp, time.Now().Format("2006-01-02")) if checkLockFile(lockfile) { log.Printf("It's already runed this day!") return nil } app, clean, err := inject.InitApplication() if err != nil { log.Fatalf("init application error %v", err) } defer clean() checkoutPeriodFile() app.Tp = TwoToneSpherePeriodStart app.Sp = SuperLottoPeriodStart app.Tn = TwoToneSphereNumbers app.Sn = SuperLottoNumbers xlog.S(context.Background()).Infof("app is %#v", app) task := func() { log.Println("begin task") err = app.Run() if err != nil { log.Fatalf("run application error %v", err) } logPeriodFile(app.Tp, app.Sp) log.Printf("task end 下一期双色球为: %d, 大乐透: %d", app.Tp, app.Sp) } task() createLockFile(lockfile) return nil }, }
View Source
var LockFileTemp string = "/tmp/period-%s"
View Source
var PeriodFile string
View Source
var SuperLottoNumbers string
View Source
var SuperLottoPeriodStart int
View Source
var TwoToneSphereNumbers string
View Source
var TwoToneSpherePeriodStart int
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.