2017 © Pedro Peláez
 

symfony-bundle cronbundle

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

image

kmj/cronbundle

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

  • Tuesday, March 29, 2016
  • by demoboy
  • Repository
  • 1 Watchers
  • 3 Stars
  • 1,346 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

KMJCronBundle

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)

1) Installation

KMJCronBundle can conveniently be installed via Composer. Just add the following to your composer.json file:, (*2)

// 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:, (*3)

    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:, (*4)

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

2) Usage

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

With your command include the following annotation at the top of your command class, (*6)


// ..
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, (*7)

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., (*8)

So a command with the following annotation, (*9)

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

Would run every five minutes at 1AM and 4AM only in the production environment., (*10)

The Versions

29/03 2016

dev-master

9999999-dev http://github.com/Demoboy/CronBundle

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

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Kaelin Jacobson

sync synchronization kmj

01/07 2013

dev-develop

dev-develop http://github.com/Demoboy/UpdateBundle

Symfony2 Bundle that manages keeping code and database up to date with eachother on a constant basis

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kaelin Jacobson

updating kmj