crontab

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Add added in v1.0.11

func Add(tp TypeJob, tag, spec string, params et.Json, repetitions int, fn func(event.Message)) error

* * Add * Add job to crontab in execute local * @param tp TypeJob, tag, spec string, params et.Json, repetitions int, fn func(event.Message) * @return error *

func AddCronjob added in v1.0.11

func AddCronjob(tag, spec string, params et.Json, repetitions int, fn func(event.Message)) error

* * AddCronjob * @param tag, spec string, params et.Json, repetitions int, fn func(event.Message) * @return error *

func AddOneShot added in v1.0.11

func AddOneShot(tag, spec string, params et.Json, repetitions int, fn func(event.Message)) error

* * AddOneShot * @param tag, spec string, params et.Json, repetitions int, fn func(event.Message) * @return error *

func Close added in v0.1.19

func Close()

func Load

func Load(tag string) error

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

func Remove added in v1.0.11

func Remove(tag string) error

* * Remove * @param tag string * @return error *

func Start

func Start(tag string) (int, error)

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

func StartCrontab added in v1.0.11

func StartCrontab() error

* * StartCrontab * @return error *

func Stop

func Stop(tag string) error

* * Stop * @param tag string * @return error *

func StopCrontab added in v1.0.11

func StopCrontab() error

* * StopCrontab * @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"`
	Idx         int           `json:"idx"`
	HostName    string        `json:"host_name"`
	Attempts    int           `json:"attempts"`
	Repetitions int           `json:"repetitions"`
	ShotTime    time.Time     `json:"shot_time"`
	Duration    time.Duration `json:"duration"`
	// contains filtered or unexported fields
}

func (*Job) Start added in v0.1.19

func (s *Job) Start() error

* * Start * @return error *

func (*Job) Stop added in v0.1.19

func (s *Job) Stop()

* * Stop * @return error *

func (*Job) ToJson added in v0.1.19

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

* * ToJson * @return et.Json *

type JobStatus added in v1.0.11

type JobStatus string
const (
	StatusPending  JobStatus = "pending"
	StatusRunning  JobStatus = "running"
	StatusDone     JobStatus = "done"
	StatusFailed   JobStatus = "failed"
	StatusStop     JobStatus = "stop"
	StatusFinished JobStatus = "finished"
)

type Jobs

type Jobs struct {
	Tag     string `json:"tag"`
	Version int    `json:"version"`
	// contains filtered or unexported fields
}

type TypeJob added in v1.0.11

type TypeJob string
const (
	TypeCronJob TypeJob = "cron-job"
	TypeOneShot TypeJob = "one-shot"
)

Jump to

Keyboard shortcuts

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