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)
| 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. |
| 148 | func (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. |