amadeus-m/cron-bundle

Symfony cron

安装: 8,723

依赖者: 0

建议者: 0

安全: 0

星星: 0

关注者: 2

分支: 77

类型:symfony-bundle

2.0.4 2019-03-09 23:56 UTC

This package is auto-updated.

Last update: 2024-09-14 10:36:49 UTC


README

Packagist Build Status Packagist License

symfony的Cron集成。

安装

通过以下简单步骤安装此包:

  1. 将包添加到项目作为composer依赖项
composer require cron/cron-bundle
  1. 将包添加到应用程序内核
// app/AppKernel.php
public function registerBundles()
{
    // ...
    $bundle = array(
        // ...
        new Cron\CronBundle\CronCronBundle(),
    );
    // ...

    return $bundles;
}
  1. 更新您的数据库模式
bin/console make:migration
bin/console doctrine:migrations:migrate
  1. 开始使用此包
bin/console cron:list
bin/console cron:run
  1. 要自动运行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许可证下发布。