crontab

package
v0.0.0-...-9c17c29 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCronManger = NewCronTabManger("DefaultCronManger")
View Source
var DefaultInterval = time.Second * 5

Functions

func AddCronJob

func AddCronJob(spec string, job cron.Job) (cron.EntryID, error)

func Close

func Close()

func GetCron

func GetCron() *cron.Cron

func RemoveCronJob

func RemoveCronJob(id cron.EntryID)

Types

type CronManger

type CronManger struct {
	// contains filtered or unexported fields
}

func NewCronTabManger

func NewCronTabManger(name string) *CronManger

func (*CronManger) AddCronJob

func (c *CronManger) AddCronJob(spec string, job cron.Job) (cron.EntryID, error)

func (*CronManger) Close

func (c *CronManger) Close()

func (*CronManger) GetCron

func (c *CronManger) GetCron() *cron.Cron

func (*CronManger) RemoveCronJob

func (c *CronManger) RemoveCronJob(id cron.EntryID)

func (*CronManger) Start

func (c *CronManger) Start() error

type Opt

type Opt func(job *regularJob)

func WithIgnorePanic

func WithIgnorePanic() Opt

WithIgnorePanic run again when panic

func WithImmediately

func WithImmediately() Opt

func WithInterval

func WithInterval(interval time.Duration) Opt

WithInterval the execution interval time of job

type RegularJob

type RegularJob interface {
	Run()
	Stop()
}

func NewRegularJob

func NewRegularJob(name string, fn func(), opts ...Opt) RegularJob

Jump to

Keyboard shortcuts

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