diff --git a/src/Command/ListCommand.php b/src/Command/ListCommand.php index d13c1ed..df2862c 100644 --- a/src/Command/ListCommand.php +++ b/src/Command/ListCommand.php @@ -33,6 +33,7 @@ protected function execute(InputInterface $input, OutputInterface $output) "ID", "Class", "Expression", + "Next Execution", "Can overlap", "Run only on one instance", ]); @@ -44,6 +45,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $job->getUniqueId(), get_class($job), $job->getSchedule()->getExpression(), + $job->getSchedule()->getNextRunDate()->format('d-m-y H:i:s'), $job->getSchedule()->checkCanOverlap() ? 'yes' : 'no', $job->getSchedule()->checkShouldRunOnOnlyOneInstance() ? 'yes' : 'no', ]); diff --git a/src/Jobs/Schedule.php b/src/Jobs/Schedule.php index 49a12f9..f66e8e8 100644 --- a/src/Jobs/Schedule.php +++ b/src/Jobs/Schedule.php @@ -195,6 +195,18 @@ public function isDue($currentTime = 'now', string $timeZone = 'Europe/Berlin'): return $this->cron->isDue($currentTime, $timeZone); } + /** + * Sets whether the job should run on just one instance + * @param bool $decision + * @return $this + * @return \DateTime + */ + public function shouldRunOnOnlyOneInstance(bool $decision = true): self + { + $this->shouldRunOnOnlyOneServer = $decision; + return $this; + } + /** * Return the next run date * @param $currentTime