Skip to content

Latest commit

 

History

History
85 lines (59 loc) · 2.44 KB

File metadata and controls

85 lines (59 loc) · 2.44 KB

Cron


Cron config

Edit the _cron.php file in the configuration folder of your module.

Add routes that are to be called recurrently.

Example: modules/Foo/etc/config/Foo/config/_cron.php

<?php

/**
 * just list concrete Routes to be called
 */
$aConfig['MODULE']['Foo']['cron'] = [

    #-------------------------------------------------------------------------------------------------------------------
    # queue
    # starts all workers that are listed in config `etc/config/{module}/config/_worker.php`.

    // which is: '/~/queue/worker/run'
    $aConfig['MVC_QUEUE_RUN'],

    // start WebSocket Server
    '/ws/serve/'
];

list cron configuration

list cron configuration

php emvicy cron:list

Example output

# Cron List
# config: /var/www/html/modules/Foo/etc/config/Foo/config/


| No  | Route                                                                                                                 |
|-----|-----------------------------------------------------------------------------------------------------------------------|
| 1   | /~/queue/worker/run                                                                                                   |
| 2   | /ws/serve/                                                                                                            |

run cron

all routes listed in the Cron config are called non-blocking via Process::callRoute()

runs emvicy cron configuration

php emvicy cron:run

crontab

Example crontab

#----------------------------------------
# Emvicy 2.x
* * * * * cd /var/www/html; /usr/bin/php emvicy cron:run > /dev/null 2>/dev/null;