balazscsaba2006/easy-cron-deployment-bundle

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

1.0.6 2020-06-19 16:42 UTC

This package is auto-updated.

Last update: 2022-09-19 22:03:25 UTC


README

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