diff --git a/utils/schedulercli.php b/utils/schedulercli.php index 1d55247c3..e0f0ef6c6 100644 --- a/utils/schedulercli.php +++ b/utils/schedulercli.php @@ -84,10 +84,14 @@ foreach($tasks as $task) { if(method_exists($taskobj, 'execute')) { if(!$task->getDisabled() && $task->isDue()) { if($mode == 'run') { - echo get_class($task); + /* Schedule the next run right away to prevent a second execution + * of the task when the cron job of the scheduler is called before + * the last run was finished. The task itself can still be scheduled + * to fast, but this is up to the admin of seeddms. + */ + $task->updateLastNextRun(); if($taskobj->execute($task)) { add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." successful."); - $task->updateLastNextRun(); } else { add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." failed, task has been disabled.", PEAR_LOG_ERR); $task->setDisabled(1);