halftome/scheduler

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

An advanced scheduler for CakePHP

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:cakephp-plugin

dev-master 2016-12-08 21:48 UTC

This package is auto-updated.

Last update: 2020-02-26 10:06:30 UTC


README

Software License Total Downloads Latest Stable Version

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer halftome/scheduler

Setup the database with migrations:

bin/cake migrations migrate -p Scheduler

Usage

The scheduler will only work if it is invoked, and will only be as precise as the interval it is invoked with. For an example, here is an example cron job using 1min (the shortest allowed interval on cron) as the interval:

* * * * * cd /path/to/app && bin/cake Scheduler.Run

Here is an example configuration to run 2 tasks:

// For example in your bootstrap.php
Configure::write('Scheduler.jobs', [
    'Newsletters' => [
        'interval' => '2 weeks',
    ],
    'CleanUp' => [
        'interval' => '15 minutes', // every 15min
        'command' => 'CleanUpDatabase clean',
        'extra' => [
            'foo' => 'bar',
        ],
        'timeout' => '15 minutes', // if task has not finished after 15min it will be aborted
    ],
    'QuotaCheck' => [
        'interval' => '6 hours',
    ],
]);