madrakio/easy-cron-deployment-bundle

Easy Cron Deployment Bundle: An easy way to manage your cron using YAML and Symfony Console

This package's canonical repository appears to be gone and the package has been frozen as a result.

1.0.2 2016-05-02 16:40 UTC

This package is not auto-updated.

Last update: 2023-08-05 12:53:37 UTC


README

Code Climate Packagist Packagist Packagist

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require madrakio/easy-cron-deployment-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new MadrakIO\EasyCronDeploymentBundle\MadrakIOEasyCronDeploymentBundle(),
        );

        // ...
    }

    // ...
}

Step 3: Create cron.yml file

Create app/config/cron.yml and follow this example:

madrak_io_easy_cron_deployment:
    jobs:
        -
            minute: 0
            hour: 0
            day: 1
            month: 1
            task: 'php somescript.php'
            hosts: ['node-1', 'node-2']
            disabled: true
        -
            minute: 0
            task: 'php someotherscript.php'

Step 4: Import cron.yml into app/config/config.yml

imports:
    - { resource: cron.yml }

Possible Commands

app/console madrakio:cron:deploy Deploy cron based on cron.yml

app/console madrakio:cron:disable Disable all current cron tasks by adding # before each line

app/console madrakio:cron:enable Remove all #s before cron tasks

app/console madrakio:cron:verify Verify that cron tasks match the ones in the cron.yml file