承接 kmj/cronbundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kmj/cronbundle

Composer 安装命令:

composer require kmj/cronbundle

包简介

Symfony2 Bundle that handles updating and installing crons into a local computers crontab

README 文档

README

Welcome to the KMJCronBundle. The goal of this bundle is to provide an easy way to manage crons. It accomplishes this goal by searching for all Symfony 2 commands using the @CronJob annotation. When found, the annotation is broken down and installed to the current user's crontab. Currently this bundle only supports linux servers. There is a know issue where if the server is running cPanel, the crontab cannot be updated. Instead list it manually and copy them to the crontab.

  1. Installation

KMJCronBundle can conveniently be installed via Composer. Just add the following to your composer.json file:

// composer.json
{
    // ...
    require: {
        // ..
        "kmj/cronbundle": "dev-master"
    }
}

Then, you can install the new dependencies by running Composer's update command from the directory where your composer.json file is located:

    php composer.phar update

Now, Composer will automatically download all required files, and install them for you. All that is left to do is to update your AppKernel.php file, and register the new bundle:

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new KMJ\CronBundle\KMJCronBundle(),
    // ...
);
  1. Usage

The KMJCronBundle only works with Symfony 2 commands [read more] (http://symfony.com/doc/master/components/console/introduction.html).

With your command include the following annotation at the top of your command class

// ..
use KMJ\CronBundle\Annotations\CronJob;
/**
 * @CronJob(hour="0", minute="0")
 */
class ExampleCommand //.. {

   //..

}

This annotation tells the KMJCronBundle that you want to run this command to execute at 12:00 AM

Since the annotation are installed to the crontab, the standard format for crons is used where * is wildcard. Any time frame not provided is a wildcard. Slashes are also available however you must use / not . The bundle converts this slash at installation.

So a command with the following annotation

@CronJob(hour="1,4", minute="/5", env="prod")

Would run every five minutes at 1AM and 4AM only in the production environment.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-02-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固