crontab

package
v1.1.223 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 17 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"
)
View Source
var (
	ErrJobExists = fmt.Errorf("job already exists")
)
View Source
var (
	MSG_CRONTAB_UNLOAD = "crontab unloaded"
)

Functions

func AddCronJob added in v1.1.197

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

* * AddCronJob * @param tag, spec string, repetitions int, started bool, params et.Json, fn func(event.EvenMessage) * @return error *

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 * @param tag, spec string, repetitions int, started bool, params et.Json, fn func(event.EvenMessage) * @return error *

func AddScheduleJob added in v1.1.208

func AddScheduleJob(tag, schedule string, started bool, params et.Json, fn func(event.EvenMessage)) error

* * AddScheduleJob * Add job to crontab in execute local * @param tag, schedule string, started bool, params et.Json, fn func(event.EvenMessage) * @return error *

func Close added in v1.1.142

func Close()

* * Close * @return void *

func HttpGet added in v1.1.208

func HttpGet(w http.ResponseWriter, r *http.Request)

* * HttpGet * @params w http.ResponseWriter, r *http.Request *

func HttpStart added in v1.1.208

func HttpStart(w http.ResponseWriter, r *http.Request)

* * HttpStart * @params w http.ResponseWriter, r *http.Request *

func HttpStop added in v1.1.208

func HttpStop(w http.ResponseWriter, r *http.Request)

* * HttpStop * @params w http.ResponseWriter, r *http.Request *

func Load

func Load(tag string, store instances.Store) error

* * Load * @params db *jdb.DB, schemaName, tag string * @return error *

func RemoveJob added in v1.1.212

func RemoveJob(tag string) error

* * RemoveJob * @param tag string * @return error *

func SetGetInstance added in v1.1.209

func SetGetInstance(fn GetInstanceFn)

func SetSetInstance added in v1.1.209

func SetSetInstance(fn SetInstanceFn)

func StartJob

func StartJob(tag string) error

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

func Stop

func Stop() error

* * Stop * @return error *

func StopJob

func StopJob(tag string) error

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

Types

type GetInstanceFn added in v1.1.182

type GetInstanceFn func(id string, dest any) (bool, error)

type Job

type Job struct {
	ID          string        `json:"id"`
	ExecuteAt   time.Time     `json:"execute_at"`
	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 (*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) SetSpec added in v1.1.217

func (s *Job) SetSpec(spec string)

* * SetSpec * @param spec string * @return void *

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()

* * 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"
	Awaiting JobStatus = "awaiting"
	Running  JobStatus = "running"
	Done     JobStatus = "done"
	Failed   JobStatus = "failed"
	Finished JobStatus = "finished"
)

type Jobs

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

func New

func New(tag string) (*Jobs, error)

type SetInstanceFn added in v1.1.182

type SetInstanceFn func(id, tag string, obj any) error

type TypeJob added in v1.1.182

type TypeJob string
const (
	CronJob     TypeJob = "cronJob"
	ScheduleJob TypeJob = "scheduleJob"
)

Jump to

Keyboard shortcuts

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