简体   繁体   中英

Cron Jobs in CakePHP have suddenly stopped

I'm working on a system that is built with CakePHP 3.5, this system has multiple Cron Jobs that run throughout the day.

These cron jobs have always been executed in the following format:

/home/myuser/public_html/bin/cake shell_name command_name

When the crons run they usually output their progress in the default system email that the server sends, for example:

Welcome to CakePHP v3.4.11 Console
---------------------------------------------------------------
App : src
Path: /home/myuser/public_html/src/
PHP : 5.6.31
---------------------------------------------------------------
Starting Thirty Minute Report Email Cron (JSON and PDF files).... 
 - Report 1 complete
 - Report 2 complete
Report emails sent.
Cron Finished.

Yesterday, with no changes to the code, these crons have stopped working.

Now all that is output is the CakePHP 3.5 Shell Helper:

Welcome to CakePHP v3.4.11 Console
---------------------------------------------------------------
App : src
Path: /home/myuser/public_html/src/
PHP : 5.6.31
---------------------------------------------------------------
Current Paths:

* app:  src
* root: /home/myuser/public_html
* core: /home/myuser/public_html/vendor/cakephp/cakephp

Available Shells:

[Bake] bake

[Migrations] migrations

[CORE] cache, i18n, orm_cache, plugin, routes, server

[app] console, backups, tasks

To run an app or core command, type `cake shell_name [args]`
To run a plugin command, type `cake Plugin.shell_name [args]`
To get help on a specific command, type `cake shell_name --help`

What is strange, is that if I run these commands via SSH (on the live production server) then they execute no problem, they also execute on localhost too.

I'm following the correct format as described in CakePHP docs, here's my shell:

namespace App\Shell;

use Cake\Console\Shell;
use Cake\Core\Configure;

class TasksShell extends Shell {

    /*****
    *** SENDS THE REPORT EMAIL AT A THIRTY MINUTE INTERVAL
    *****/
    public function thirtyMinReport() {
      /** CODE **/
    }

}

and the cron being run is:

/home/myuser/public_html/bin/cake tasks thirty_min_report

Today I've also tried variations of it:

/home/myuser/public_html/bin/cake tasks thirtyMinReport
/home/myuser/public_html/bin/cake Tasks thirtyMinReport
php /home/myuser/public_html/bin/cake.php Tasks thirtyMinReport
cd /home/myuser/public_html && bin/cake Tasks thirtyMinReport

I have also found somebody else having the same issue on the CakePHP site here , however that is still unresolved too.

What can I be overlooking that is stopping the cron shell_name and command_name from being found?

For anybody who was having trouble, I managed to find the answer to this myself.

For some reason unknown to me, the server php config had been updated, and now register_argc_argv was set to Off.

I re-enabled this and the cron jobs are working again.

register_argc_argv = On

This edit was made to /opt/alt/php56/etc/php.ini

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM