cron

package
v0.0.0-...-160c400 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL