troopers / cron-bundle
此包已废弃,不再维护。未建议替代包。
此包最新版本(0.1-beta1)的许可信息不可用。
用于以cron方式运行命令的Symfony扩展包
0.1-beta1
2018-02-02 00:03 UTC
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
概要
此扩展包用于通过yaml配置文件定义symfony命令作为cron。
安装
运行composer require robinstraub/cron-bundle
如果您不使用flex,请在AppKernel中注册此扩展包
class AppKernel extends Kernel { public function registerBundles() { $bundles = array( ... new Troopers\CronBundle\CronBundle(), ... ); return $bundles
配置
在config.yml
中添加您的配置。以下示例显示了如何自定义您的命令
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
键,您可以使用报告工具来跟踪任务执行。目前唯一可用的工具是api
。
API
url
:API URL(基本URI和API路由)api_key
:用于身份验证的可选API密钥format
:用于数据的数据格式。目前仅实现form。默认值为form
任务
要执行的命令列表。
command
:要执行的命令schedule
:cron计划arguments
:命令的参数列表
设置cron任务
将以下行添加到您的crontab中
* * * * * /path/to/symfony/install/app/console cron:run 1>> /dev/null 2>&1