MCPcopy
hub / github.com/robfig/cron / AddJob

Method AddJob

cron.go:148–154  ·  cron.go::Cron.AddJob

AddJob adds a Job to the Cron to be run on the given schedule. The spec is parsed using the time zone of this Cron instance as the default. An opaque ID is returned that can be used to later remove it.

(spec string, cmd Job)

Source from the content-addressed store, hash-verified

146// The spec is parsed using the time zone of this Cron instance as the default.
147// An opaque ID is returned that can be used to later remove it.
148func (c *Cron) AddJob(spec string, cmd Job) (EntryID, error) {
149 schedule, err := c.parser.Parse(spec)
150 if err != nil {
151 return 0, err
152 }
153 return c.Schedule(schedule, cmd), nil
154}
155
156// Schedule adds a Job to the Cron to be run on the given schedule.
157// The job is wrapped with the configured Chain.

Callers 4

AddFuncMethod · 0.95
TestJobPanicRecoveryFunction · 0.80
TestInvalidJobSpecFunction · 0.80
TestJobFunction · 0.80

Calls 2

ScheduleMethod · 0.95
ParseMethod · 0.65

Tested by 3

TestJobPanicRecoveryFunction · 0.64
TestInvalidJobSpecFunction · 0.64
TestJobFunction · 0.64