crontab

package
v1.1.204 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EVENT_CRONTAB_SET    = "event:crontab:set"
	EVENT_CRONTAB_DELETE = "event:crontab:delete"
	EVENT_CRONTAB_STOP   = "event:crontab:stop"
	EVENT_CRONTAB_START  = "event:crontab:start"
)
View Source
var (
	ErrJobExists = fmt.Errorf("job already exists")
)
View Source
var (
	MSG_CRONTAB_UNLOAD = "crontab unloaded"
)

Functions

func AddEventJob added in v1.1.182

func AddEventJob(tag, spec string, repetitions int, started bool, params et.Json, fn func(event.EvenMessage)) error

* * AddEventJob * Event job to crontab function execute was notified by event workers * @param tag, spec string, repetitions int, started bool, params et.Json, fn func(event.EvenMessage) * @return error *

func AddOneShotEventJob added in v1.1.182

func AddOneShotEventJob(tag, spec, channel string, started bool, params et.Json, fn func(event.EvenMessage)) error

* * AddOneShotEventJob * Event job to crontab function execute was notified by event workers * @param tag, spec, channel string, repetitions int, started bool, params et.Json, fn func(event.EvenMessage) * @return *Job, error *

func Close added in v1.1.142

func Close()

* * Close * @return void *

func DeleteJob

func DeleteJob(tag string) error

* * DeleteJob * @param tag string * @return error *

func Load

func Load(tag string) error

* * Load * @params tag string * @return error *

func SetLoadInstance added in v1.1.197

func SetLoadInstance(fn LoadInstanceFn)

func SetSaveInstance added in v1.1.197

func SetSaveInstance(fn SaveInstanceFn)

func StartJob

func StartJob(tag string) (int, error)

* * StartJob * @param tag string * @return int, error *

func Stop

func Stop() error

* * Stop * @return error *

func StopJob

func StopJob(tag string) error

* * StopJob * @param tag string * @return error *

Types

type Job

type Job struct {
	Type        TypeJob       `json:"type"`
	Tag         string        `json:"tag"`
	Channel     string        `json:"channel"`
	Params      et.Json       `json:"params"`
	Spec        string        `json:"spec"`
	Started     bool          `json:"started"`
	Status      JobStatus     `json:"status"`
	HostName    string        `json:"host_name"`
	Attempts    int           `json:"attempts"`
	Repetitions int           `json:"repetitions"`
	Duration    time.Duration `json:"duration"`
	// contains filtered or unexported fields
}

func AddCronJob added in v1.1.197

func AddCronJob(tag, spec string, params et.Json, repetitions int, started bool, fn func(job *Job)) (*Job, error)

* * AddCronJob * Add cron job to crontab in execute local * @param tag, spec string, params et.Json, repetitions int, started bool, fn func(job *Job) * @return *Job, error *

func AddJob

func AddJob(tag, spec string, params et.Json, repetitions int, started bool, fn func(job *Job)) (*Job, error)

* * AddJob * Add job to crontab in execute local * @param tag, spec string, params et.Json, repetitions int, started bool, fn func(job *Job) * @return *Job, error *

func AddOneShotJob added in v1.1.182

func AddOneShotJob(tag, spec string, params et.Json, repetitions int, started bool, fn func(job *Job)) (*Job, error)

* * AddOneShotJob * Add job to crontab in execute local * @param tag, spec string, params et.Json, repetitions int, started bool, fn func(job *Job) * @return *Job, error *

func (*Job) Finish added in v1.1.197

func (s *Job) Finish()

* * Finish * @return error *

func (*Job) Save added in v1.1.197

func (s *Job) Save() error

* * save * @return error *

func (*Job) Start added in v1.1.142

func (s *Job) Start() error

* * Start * @return error *

func (*Job) Stop added in v1.1.142

func (s *Job) Stop() error

* * Stop * @return error *

func (*Job) ToJson added in v1.1.142

func (s *Job) ToJson() et.Json

* * ToJson * @return et.Json *

type JobStatus added in v1.1.182

type JobStatus string
const (
	Pending  JobStatus = "pending"
	Prepared JobStatus = "prepared"
	Running  JobStatus = "running"
	Done     JobStatus = "done"
	Failed   JobStatus = "failed"
	Finished JobStatus = "finished"
)

type Jobs

type Jobs struct {
	Id       string          `json:"id"`
	HostName string          `json:"host_name"`
	Jobs     map[string]*Job `json:"jobs"`
	// contains filtered or unexported fields
}

func New

func New() *Jobs

type LoadInstanceFn added in v1.1.197

type LoadInstanceFn func(id string) (*Job, error)

type SaveInstanceFn added in v1.1.197

type SaveInstanceFn func(*Job) error

type TypeJob added in v1.1.182

type TypeJob string
const (
	CronJob TypeJob = "cronJob"
	CronTab TypeJob = "cronTab"
)

Jump to

Keyboard shortcuts

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