TaskSchedulerBundle | Task Scheduler with CRON for Symfony | Cron Utils library
kandi X-RAY | TaskSchedulerBundle Summary
kandi X-RAY | TaskSchedulerBundle Summary
Task Scheduler with CRON for Symfony
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of TaskSchedulerBundle
TaskSchedulerBundle Key Features
TaskSchedulerBundle Examples and Code Snippets
use Rewieer\TaskSchedulerBundle\Task\AbstractScheduledTask;
use Rewieer\TaskSchedulerBundle\Task\Schedule;
class Task extends AbstractScheduledTask {
protected function initialize(Schedule $schedule) {
$schedule
->minutes(0)
-&g
use Rewieer\TaskSchedulerBundle\Task\AbstractScheduledTask;
use Rewieer\TaskSchedulerBundle\Task\Schedule;
class Task extends AbstractScheduledTask {
protected function initialize(Schedule $schedule) {
$schedule
->everyMinutes(5); //
// in AppKernel::registerBundles()
$bundles = array(
// ...
new Rewieer\TaskSchedulerBundle\RewieerTaskSchedulerBundle(),
// ...
);
Community Discussions
Trending Discussions on TaskSchedulerBundle
QUESTION
I am trying to create a central cron controller in Symfony, similar to what does Laravel. I found this great component: https://github.com/rewieer/TaskSchedulerBundle but I can not make it work.
The documentation is for Symfony 2 and I am using 4.3
I tried to adapt what I understood.
There is no AppKernel.php so I used app/config/bundles.php
It looks similar to this
...ANSWER
Answered 2019-Jul-10 at 15:27To see what is going on, you can use the command ts:list
. Does this list the command in question? Then your service definition is fine, and the problem lies within your task.
To check this further, let's inspect your task: by defining $schedule->everyMinutes(5);
, you specify that it should only run when the current minute is divisible by five. So, if you for example run ts:run
on 17:03, the task will not execute. If you call ts:run
on 17:05, it will execute. The cron concept does not save the last execution time and rerun your task after five minutes have elapsed - the other way around, if you call the runner multiple times within that same minute (so before 17:05:59), the task will also be executed multiple times.
While debugging, it might be helpful to skip this part. By not defining any schedule (through leaving this empty), your task will run on each call.
Additionally, how did you check whether the task ran or not? Your sample code does not contain any action to be run, so you could at least add any debug output
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install TaskSchedulerBundle
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page