定制 wojtekn/magento2-cron-manager 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wojtekn/magento2-cron-manager

Composer 安装命令:

composer require wojtekn/magento2-cron-manager

包简介

Magento 2 module which allows enabling/disabling Magento 2 cron jobs in crontab.

README 文档

README

A Magento 2 module which adds CLI commands to enable and disable Magento 2 crontab entries.

Installation

Please, use Composer and add wojtekn/magento2-cron-manager to your dependencies eg.

$ composer require wojtekn/magento2-cron-manager

Then enable the module and run setup upgrade to be sure that module is installed and enabled:

$ php bin/magento setup:upgrade

If you're using production or default Magento 2 mode you need to run Dependency Injection compilation process:

$ php bin/magento setup:di:compile

Usage

Before you start

Make sure to backup your current crontab entries to be able to revert them if something goes wrong.

You can do this by running:

crontab -l > ~/crontab.backup

Simple usage

Before first use edit crontab using default editor by running crontab -e and add tags showing where Magento 2 related jobs start and end. That part of the crontab should look as follows:

# [start:magento]
* * * * * php <magento install dir>/bin/magento cron:run --group=index | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
* * * * * php <magento install dir>/bin/magento cron:run --group=mailchimp | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
# [end:magento]

Now run following command to disable CRON entries:

php bin/magento cron:crontab:disable

And this one to enable CRON entries:

php bin/magento cron:crontab:enable

Advanced usage

If you run multiple Magento environments on the same server you may want to define multiple crontab groups and enable/disable only particular one.

To define custom group, replace "magento" key with another label eg. "custom-group":

# [start:magento]
* * * * * php <magento install dir>/bin/magento cron:run --group=index | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
* * * * * php <magento install dir>/bin/magento cron:run --group=mailchimp | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
# [end:magento]

# [start:custom-group]
* * * * * php <magento install dir>/bin/magento cron:run --group=another | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
# [end:custom-group]

Then you can run following command to disable CRON entries from "custom-group" group:

php bin/magento cron:crontab:disable --group=custom-group

And this one to enable those CRON entries:

php bin/magento cron:crontab:enable --group=custom-group

Default value for group parameter is magento.

To Do

  • allow listing cron entries

Credits

统计信息

  • 总下载量: 581
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固