Cron Bundle
Installing this bundle can be done through these simple steps:
- Add the bundle to your project as a composer dependency:
// composer.json
{
// ...
require: {
// ...
"cron/cron-bundle": "^1.5"
}
}
- Update your composer installation:
composer update
- Add the bundle to your application kernel:
// app/AppKernel.php
public function registerBundles()
{
// ...
$bundle = array(
// ...
new Cron\CronBundle\CronCronBundle(),
);
// ...
return $bundles;
}
- Update your DB schema
bin/console doctrine:schema:update
- Start using the bundle:
bin/console cron:list
bin/console cron:run
- To run your cron jobs automatically, add the following line to your crontab:
* * * * * /path/to/symfony/install/app/console cron:run 1>> /dev/null 2>&1
bin/console cron:list
Show a list of all jobs. Job names are show with [x]
if they are enabled and [ ]
otherwise.
bin/console cron:create
Create a new job.
bin/console cron:delete _jobName_
Delete a job. For your own protection, the job must be disabled first.
bin/console cron:enable _jobName_
Enable a job.
bin/console cron:disable _jobName_
Disable a job.
bin/console cron:run [--force] [job]
PHP 5.3.2 or above