Schedular recurring task

Hello,

I have a simple question. May be I dont understand something wrong…

How I can place a task to run every 15 minutes for example?
Is it possible? I yes, how could I do that in manager.

Thank you in advance

bye
Chris

You have to use Cron on the server for that.

And the extra CronManager could help you facilitate the recurring execution of a snippet.

thank you.

I mean with the extra from modmore “scheduler”.

Is it also possible?

this is meant for scheduling tasks once. You will still need a cronjob, on which scheduler would watch for.
You could of course create tasks, which register themselve to run 15 minutes later, again.
But then, you could just tell the cronjob to run your task directly all 15 minutes.

This link could also be helpful:

And if cron is not availabe on your server, then maybe you can use web-based cron-job provider instead.

thank you very much.
Please excuse my bad english.

yes, I need to create a cron job.

I use the extra from Mark Hamsta:

I only can set up a one time task in Manager.

thank you

bye
Chris

As @bruno17 said, the extra “Scheduler” isn’t really suitable for recurring tasks.

With the extra “CronManager” on the other hand, it is easy to execute a snippet periodically.
Or you could write you own PHP-File (without the need to install an extra) and call it repeatedly with a cron job, like described in the link I posted above.

Is there a reason why you categorically want to use the extra “Scheduler”?

With “Scheduler” you basically have 2 options:

  • Scheduling the same task again, every time your task runs ($task->schedule())
  • Creating a new PHP-File similar to assets/components/scheduler/run.php that explicitly just runs one defined task. You would then need to create a second cron job to call this new file repeatedly (with the desired time interval).

Probably because it’s awesome :mage: :joy: You’re absolute right though @halftrainedharry, its primary focus is for one-time tasks and it needs to re-schedule itself to run in a recurring fashion. Using a cron job to schedule the task hourly is a great idea as well, but does require writing some more code.

It does make sense to use it for recurring tasks when those run along one-time tasks, so you can see what’s happening in the background and have a single place where tasks are managed. That’s how the modmore site itself uses Scheduler which gives me insight into both how the hourly backups are going and wether invoice generation for orders is operational too.

Simply this at the top of a task will schedule it again for the next hour:

$task->schedule(time() + (60 * 60));