|
|
@ -19,8 +19,7 @@ func NewJobScheduler() *JobScheduler {
|
|
|
|
|
|
|
|
|
|
|
|
// ScheduleJob schedules the execution of a job via a runner
|
|
|
|
// ScheduleJob schedules the execution of a job via a runner
|
|
|
|
func (scheduler *JobScheduler) ScheduleJob(runner portainer.JobRunner) error {
|
|
|
|
func (scheduler *JobScheduler) ScheduleJob(runner portainer.JobRunner) error {
|
|
|
|
_, err := scheduler.cron.AddJob(runner.GetSchedule().CronExpression, runner)
|
|
|
|
return scheduler.cron.AddJob(runner.GetSchedule().CronExpression, runner)
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UpdateSystemJobSchedule updates the first occurence of the specified
|
|
|
|
// UpdateSystemJobSchedule updates the first occurence of the specified
|
|
|
@ -36,7 +35,7 @@ func (scheduler *JobScheduler) UpdateSystemJobSchedule(jobType portainer.JobType
|
|
|
|
|
|
|
|
|
|
|
|
for _, entry := range cronEntries {
|
|
|
|
for _, entry := range cronEntries {
|
|
|
|
if entry.Job.(portainer.JobRunner).GetSchedule().JobType == jobType {
|
|
|
|
if entry.Job.(portainer.JobRunner).GetSchedule().JobType == jobType {
|
|
|
|
_, err := newCron.AddJob(newCronExpression, entry.Job)
|
|
|
|
err := newCron.AddJob(newCronExpression, entry.Job)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -70,7 +69,7 @@ func (scheduler *JobScheduler) UpdateJobSchedule(runner portainer.JobRunner) err
|
|
|
|
jobRunner = entry.Job
|
|
|
|
jobRunner = entry.Job
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_, err := newCron.AddJob(runner.GetSchedule().CronExpression, jobRunner)
|
|
|
|
err := newCron.AddJob(runner.GetSchedule().CronExpression, jobRunner)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|