amadeus-m / cron-bundle
Symfony cron
2.0.4
2019-03-09 23:56 UTC
Requires
- php: >=5.5.9
- cron/cron: ^1.0.1
- doctrine/doctrine-bundle: ~1.4
- doctrine/orm: ~2.4,>=2.4.5
- symfony/framework-bundle: ^3.4|^4.0
Requires (Dev)
- phpunit/phpunit: ^4.0
- symfony/symfony: ^2.4|^3.0|^4.0
README
symfony的Cron集成。
安装
通过以下简单步骤安装此包:
- 将包添加到项目作为composer依赖项
composer require cron/cron-bundle
- 将包添加到应用程序内核
// app/AppKernel.php public function registerBundles() { // ... $bundle = array( // ... new Cron\CronBundle\CronCronBundle(), ); // ... return $bundles; }
- 更新您的数据库模式
bin/console make:migration bin/console doctrine:migrations:migrate
- 开始使用此包
bin/console cron:list bin/console cron:run
- 要自动运行cron作业,请将以下行添加到您的(crontab)
* * * * * /path/to/symfony/install/app/console cron:run 1>> /dev/null 2>&1
或者 如果您没有专门的cron守护进程(例如在Heroku上),可以使用
bin/console cron:start # will run in background mode, use --blocking to run in foreground bin/console cron:stop # will stop the background cron daemon
可用命令
list
bin/console cron:list
显示所有作业的列表。如果作业已启用,则作业名称显示为[×],否则为[ ]。
create
bin/console cron:create
创建一个新的作业。
delete
bin/console cron:delete _jobName_
删除一个作业。出于您的保护,作业必须首先被禁用。
enable
bin/console cron:enable _jobName_
启用一个作业。
disable
bin/console cron:disable _jobName_
禁用一个作业。
run
bin/console cron:run [--force] [job]
(我们从Symfony借用的)。请确保查看php-cs-fixer,这将非常有帮助。
start
bin/console cron:start [--blocking]
以守护进程方式启动cron。默认情况下,它将在后台自行分叉并抑制任何输出。使用--blocking
选项将使其保持在前台并显示输出。这在您没有专门的cron守护进程(例如在Heroku上)时很有用。
stop
bin/console cron:stop
停止使用cron:start
启动的后台cron守护进程。如果守护进程是使用--blocking
启动的,则不适用。
如果您想帮忙,请查看问题列表。
要求
PHP 5.5.9或更高版本
作者和贡献者
Dries De Peuter - dries@nousefreak.be - http://nousefreak.be
还可以查看参与此项目的贡献者列表。
许可证
CronBundle在MIT许可证下发布。