nisanov/cron-command-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

A Symfony bundle that manages and integrates commands with the Linux crontab, by tracking command execution status and identifying commands that are overdue.

Installs: 29

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:symfony-bundle

1.0.4 2017-08-30 09:35 UTC

This package is auto-updated.

Last update: 2024-01-29 10:13:21 UTC


README

A Symfony bundle that manages and integrates commands with the Linux crontab, by tracking command execution status and identifying commands that are overdue.

License Latest Stable Version coverage report build status Codacy Badge

  1. Installation
  2. Usage
  3. Testing

Installation

Step 1: Download the Bundle

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

$ composer require nisanov/cron-command-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 = [
            
            // ...

            new Nisanov\CronCommandBundle\NisanovCronCommandBundle(),
        ];

        // ...
    }

    // ...
}

Step 3: Update the database

php bin/console doctrine:schema:update --force

Usage

Adding/Modifying a command to the database and crontab

php bin/console cron:command:set

Follow the prompts after executing the above command to add or modify a command to the database and the crontab.

Removing a command from the database and crontab

php bin/console cron:command:set --remove

Follow the prompts after executing the above command to remove a command from the database and the crontab.

Synchronizing commands with the crontab after any manual manipulation of either.

php bin/console cron:command:synchronize

Getting statistical information on active commands stored in the database and crontab

php bin/console cron:command:statistics

Statistical information is displayed in the console after executing the above command.

The following service request provides the same information that can be utilized by other aspects of your application.

// reference the container in a context applicable way
$container->get('nisanov_cron_command.manager')->statistics();
Example
 ======================== =========== ===================== ===================== ===================== ============ =========== ==============
  Name                     Schedule    Created At            Last Success Ran At   Next Run At           Is Overdue   Exit Code   Exit Message                                   
 ======================== =========== ===================== ===================== ===================== ============ =========== ==============
  swiftmailer:spool:send   * * * * *   2017-05-15 10:15:30   2017-05-15 10:16:02   2017-05-15 10:17:00   0            0                                                          
 ======================== =========== ===================== ===================== ===================== ============ =========== ==============

Testing

Run phpunit tests with the following command:

vendor/bin/phpunit -c vendor/nisanov/cron-command-bundle/phpunit.xml.dist

WARNING: The unit tests manipulate the real crontab.