gofmanaa/yii2-crontask

yii2 cron task manager

Installs: 11 714

Dependents: 0

Suggesters: 0

Security: 0

Stars: 9

Watchers: 2

Forks: 4

Open Issues: 1

Type:yii2-extension

1.4 2018-06-07 13:45 UTC

This package is not auto-updated.

Last update: 2024-11-15 21:18:40 UTC


README

yii2 cron task manager

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist gofmanaa/yii2-crontask "*"

or add

"gofmanaa/yii2-crontask": "*"

to the require section of your composer.json file.

Requirements

Linux OS Yii2

Usage

Add to console config:

return [
    'bootstrap' => [
        'crontask'
    ],
    'modules' => [
        'crontask' => [
            'class' => 'gofmanaa\crontask\Module',
            'fileName'=>'cron.txt', //optional
            'params'=>[ '2>&1' ], //common params
            'yiiPath' => null // yii execute path
            'phpPath' => '/usr/bin/php', //default php path
            'tasks'=>[
                'dosomething'=>
                            [
                               'params'=>[ '--some=something' , '>/dev/null' ], //task params
                               'command'=>'path/to/controller/action',
                               'min'=>'*/1',
                               'hour'=>'*',
                               'day'=>'*',
                               'month'=>'*',
                               'dayofweek'=>'*',
                            ],
                'dosomething2'=>
                            [
                                'command'=>'path/to/controller/action',
                                'min'=>'*/2',
                            ],
            ]
        ],
    ],
]

Console command

- crontask                    Provides cron information about console commands.
    crontask/index (default)  Displays available commands or the detailed information
    crontask/ls               List App Cron tasks;   crontask/ls a All cron jobs
    crontask/start            Start cron tasks,  "crontask/start dosomething2"  start single task
    crontask/stop             Stop App cron. "crontask/stop 3"  stop task by index 3 
    crontask/restart          Restart cron tasks