cron

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JOB_TYPE_SYSTEM = 0 // 系统任务,不会被删除
	JOB_TYPE_BACKUP = 1 // 备份任务
	JOB_TYPE_PRUNE  = 2 // 清理任务
)

Variables

This section is empty.

Functions

func AddJob

func AddJob(cronStr string, job BaseJob) error

func CheckCron

func CheckCron(cronStr string) string

func ClearJob

func ClearJob()

func GetNextTimes

func GetNextTimes(cronStr string) ([]string, error)

GetNextTimes 生成下次执行时间列表

func InitCron

func InitCron()

Types

type BackupJob

type BackupJob struct {
	PlanId int
}

func (BackupJob) GetType

func (b BackupJob) GetType() int

func (BackupJob) Run

func (b BackupJob) Run()

type BaseJob

type BaseJob interface {
	GetType() int
	cron.Job
}

type PruneJob

type PruneJob struct {
	PlanId int
}

func (PruneJob) GetType

func (b PruneJob) GetType() int

func (PruneJob) Run

func (b PruneJob) Run()

type SystemJob

type SystemJob func()

func (SystemJob) GetType

func (f SystemJob) GetType() int

func (SystemJob) Run

func (f SystemJob) Run()

Jump to

Keyboard shortcuts

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