crontab

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusAdded    = "added"
	StatusPending  = "pending"
	StatusStarting = "starting"
	StatusDone     = "done"
	StatusNotified = "notified"
	StatusRunning  = "running"
	StatusStopped  = "stopped"
	StatusExecuted = "executed"
	StatusRemoved  = "removed"
	StatusFailed   = "failed"
)

Variables

View Source
var (
	EVENT_CRONTAB_SERVER = "event:crontab:server"
	EVENT_CRONTAB_SET    = "event:crontab:set"
	EVENT_CRONTAB_STATUS = "event:crontab:status"
	EVENT_CRONTAB_STOP   = "event:crontab:stop"
	EVENT_CRONTAB_START  = "event:crontab:start"
	EVENT_CRONTAB_DELETE = "event:crontab:delete"
	EVENT_CRONTAB_FAILED = "event:crontab:failed"
)
View Source
var (
	ErrJobExists = fmt.Errorf("job already exists")
)

Functions

func Close added in v0.1.19

func Close()

func DeleteJob

func DeleteJob(name string) error

* * DeleteJob * @param name string * @return error *

func DeleteJobById

func DeleteJobById(id string) error

* * DeleteJobById * @param id string * @return error *

func EventJob added in v0.1.19

func EventJob(id, name, spec, channel string, repetitions int, start bool, params et.Json, fn func(event.Message)) error

* * EventJob * Event job to crontab function execute was notified by event workers * @param id, name, spec, channel string, repetitions int, start bool, params et.Json, fn func(event.Message) * @return *Job, error *

func EventStatusDone added in v0.1.19

func EventStatusDone(data et.Json) error

* * EventStatusPending * @param data et.Json * @return error *

func EventStatusFailed added in v0.1.19

func EventStatusFailed(data et.Json) error

* * EventStatusFailed * @param data et.Json * @return error *

func EventStatusRunning added in v0.1.19

func EventStatusRunning(data et.Json) error

* * EventStatusRunning * @param data et.Json * @return error *

func IsMaster added in v0.1.19

func IsMaster() bool

* * IsMaster * @return bool *

func ListJobs

func ListJobs() (et.Items, error)

* * ListJobs * @return et.Items, error *

func Load

func Load() error

* * Load *

func PushEventJob added in v0.1.19

func PushEventJob(id, name, spec, channel string, repetitions int, start bool, params et.Json) error

* * PushEventJob * Push job to crontab was notified by event workers * @param id, name, spec, channel string, repetitions int, start bool, params et.Json * @return error *

func Server added in v0.1.19

func Server() error

* * Server * @return error *

func Start

func Start() error

* * Start * @return error *

func StartJob

func StartJob(name string) (int, error)

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

func StartJobById

func StartJobById(id string) error

* * StartJobById * @param id string * @return error *

func Stop

func Stop() error

* * Stop * @return error *

func StopJob

func StopJob(name string) error

* * StopJob * @param name string * @return error *

func StopJobById

func StopJobById(id string) error

* * StopJobById * @param id string * @return error *

Types

type Job

type Job struct {
	Id          string  `json:"id"`
	Name        string  `json:"name"`
	Channel     string  `json:"channel"`
	Params      et.Json `json:"params"`
	Spec        string  `json:"spec"`
	Started     bool    `json:"started"`
	Status      string  `json:"status"`
	Idx         int     `json:"idx"`
	NodeId      int64   `json:"node_id"`
	Attempts    int     `json:"attempts"`
	Repetitions int     `json:"repetitions"`
	// contains filtered or unexported fields
}

func AddJob

func AddJob(id, name, spec, channel string, params et.Json, repetitions int, start bool, fn func(job *Job)) (*Job, error)

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

func (*Job) Remove added in v0.1.19

func (s *Job) Remove() error

* * Remove * @return error *

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 Jobs

type Jobs struct {
	Id    string `json:"id"`
	Team  string `json:"team"`
	Level string `json:"level"`
	// contains filtered or unexported fields
}

func New

func New() *Jobs

Jump to

Keyboard shortcuts

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