Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run every X minutes #75

Closed
dhaarbrink opened this issue Jan 10, 2019 · 3 comments
Closed

Run every X minutes #75

dhaarbrink opened this issue Jan 10, 2019 · 3 comments

Comments

@dhaarbrink
Copy link
Contributor

There are some jobs I would like to schedule every x minutes.
I figured I could do it with ->everyMinute(5) or maybe ->hourly('*/5') but both aren't supported.

The latter could work if validateCronRange() is fixed to support it.

For now I use this workaround: ->at('*/5 * * * *'). But it is ugly, and kind of defeats the purpose of using an interface for scheduling.

I would think this is a common enough usage to be supported by the interface.

@nikolee
Copy link

nikolee commented Feb 4, 2019

->everyMinute(5) is a more elegant syntax rather than:

$runtime = array(0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55);
foreach ($runtime as $timer) {
$scheduler->php('/path/to/the/job/php')->hourly($timer);
}

@mtalha91
Copy link

mtalha91 commented Apr 3, 2019

I used $object->at('42 * * * *') to run cron job after every 42 minutes. But when the cron job is run, it is run more than one time.

For example. A cron job is scheduled at every 42 minutes. When the time came, the cron job runs at the exact time but also multiples time.

Any help would be appreciated.

@dhaarbrink
Copy link
Contributor Author

@peppeocchi I took the liberty to write a patch for this feature: #82. Could you please review? Thanks.

peppeocchi pushed a commit that referenced this issue Jun 19, 2019
* [#75] Run a job every X minutes

* [#75] Fixed cs issue

* [#75] explain the new feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants