troopers / cron-bundle
Symfony bundle for running commands as cron
Installs: 34
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 10
Forks: 0
Open Issues: 1
Type:symfony-bundle
Requires
- php: >=7.0.0
- dragonmantank/cron-expression: ^2.0
- eightpoints/guzzle-bundle: ^7.3
- symfony/framework-bundle: ^2.8|^3.4|^4.0
Requires (Dev)
- phpunit/phpunit: ^6.5
- symfony/console: ^2.8|^3.4|^4.0
- symfony/phpunit-bridge: ^3.4|^4.0
- symfony/yaml: ^2.8|^3.4|^4.0
This package is not auto-updated.
Last update: 2021-12-06 23:20:42 UTC
README
CronBundle
Synopsis
This bundle is used to define symfony commands as cron using a yaml configuration file.
Install
run composer require robinstraub/cron-bundle
If you are not using flex, registrer the bundle in AppKernel
class AppKernel extends Kernel { public function registerBundles() { $bundles = array( ... new Troopers\CronBundle\CronBundle(), ... ); return $bundles
Configuration
Add your configuration in config.yml
. See the following example on for how to customize your commands
troopers_cron: reporting: api: url: 'http://monitoring_api.local/api/cron' api_key: 'myapikey' format: form tasks: - command: 'help' schedule: '* * * * *' arguments: command_name: 'cache:clear' - command: 'cache:clear' schedule: '@daily' arguments: --env: 'prod' --no-debug: null
Reporting
The reporting
key let you use a reporting tool in order to keep track of tasks execution.
The only tool available for now is the api
.
api
url
: api url (base uri and api route)api_key
: optional api_key used for authenticationformat
: format used for the data. Only form is implemented. Default value is form
tasks
The list of commands to execute.
command
: command to executeschedule
: cron schedulearguments
: list of the command's arguments
Mise en place des cron
Add the following line to your crontab:
* * * * * /path/to/symfony/install/app/console cron:run 1>> /dev/null 2>&1