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

1.0.2 2016-05-02 16:40 UTC

This package is not auto-updated.

Last update: 2023-03-18 10:30:28 UTC


Code Climate Packagist Packagist Packagist


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:

// 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:

            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

    - { 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