dev-master
9999999-dev https://github.com/gregdoak/CronBundleThis bundle provides cron management.
MIT
The Requires
by Greg Doak
orm log bundle doctrine symfony cron
Wallogit.com
2017 © Pedro Peláez
This bundle provides cron management.
This bundle provides cron management utilities for your Symfony Project, (*1)
Add greg-doak/cron-bundle to your composer.json, (*2)
$ composer require greg-doak/cron-bundle
Register the bundle in config/bundles.php, (*3)
return [
// ...
GregDoak\CronBundle\GregDoakCronBundle::class => ['all' => true],
];
Create the database tables, (*4)
$ php bin/console doctrine:migrations:diff $ php bin/console doctrine:migrations:migrate
Or, (*5)
$ php bin/console doctrine:schema:update --force
Create your first task, (*6)
$ php bin/console cron:create
Add the scheduler to your cron, (*7)
*/5 * * * * php /root/to/your/application/bin/console cron:run:scheduled
Or alternatively to run the scheduler on page request Configure services.yaml, (*8)
parameters:
// ...
gregdoak.cron.run_on_request: true
This can have performance issues so is recommended to run on Development environments only, (*9)
Run a single task, you will be prompted for which task to run, (*10)
$ php bin/console cron:run:single
Kill a running task, you will be prompted for the running task, (*11)
$ php bin/console cron:kill
Update a task, (*12)
$ php bin/console cron:update
There are 3 database tables created:, (*13)
cron_jobs - A record is created whenever the scheduler or single task is run and ensures tasks cannot be ran simultaneously. It also records a start and end time to measure performance of the entire job, (*14)
cron_job_tasks - Each record consists of a single task, running tasks will be reserved by recording a cron_job_id, (*15)
cron_job_logs - A log is created for each task to record the output, exit code, start and end times, (*16)
This bundle provides cron management.
MIT
orm log bundle doctrine symfony cron