kfosoft/symfony-crontab

Symfony Crontab

安装: 21

依赖: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

20.10 2020-10-13 15:56 UTC

This package is auto-updated.

Last update: 2024-09-14 01:17:11 UTC


README

安装

使用Composer进行安装

运行以下命令

composer require kfosoft/symfony-crontab

配置

您必须在config/packages示例文件中添加crontab配置

crontab:
  tab:
    # Internal job without params
    SomeJob:
      type: 'internal'
      command: 'symfony:command:name'
      expression: '*/1 * * * *'
    # Internal job with params
    SomeJobWithParams:
      type: 'internal'
      command: 'symfony:command:name'
      expression: '*/1 * * * *'
      params:
        argument1: 'argument'
        --option1: 'long option'
        -t: 'short option'
    # External job example
    ExternalSomeJob:
      type: 'external'
      command: '/bin/bash test -a --opt=123'
      expression: '*/1 * * * *'

使用

bin/console cron:daemon

Supervisor配置

[program:symfony-cron]
command=/fullpath/to/bin/console cron:daemon 
autostart=true
autorestart=true
user=user_name_or_id
redirect_stderr=true