samedi 2 juillet 2016

CronJob not running CakePHP3

In my CakePHP3 application, I have a shell called Message360.

namespace AppShell;

use CakeConsoleShell;
use CakeI18nTime;

class Message360Shell extends Shell
{

    public function initialize() 
    {
        parent::initialize();
        $this->loadModel("Subscriptions");
    }

    public function main()
    {
        require_once( ROOT .DS. "vendor" .DS. "message360" .DS. "message360.php");

        $Message360 = new Message360ApiLibMessage360;
        $Message360::getInstance();
        $Message360->setOptions(array(
            "account_sid" => "c77ddb33-8dbb-f6c2-2f95-59e0173b24d9",
            "auth_token" => "dd032baa394e66a9aa32b0282d9d0390",
            "response_to_array" => true
        ));

        //Get today's date, then send SubReminds based on contact method
        $now = Time::now();
    }
}

I've removed a lot of the actual code since its not pertinent to the question.

The Shell runs the main function fine when I manually run it via bin/cake message360

However, I installed a CronTab in order to run it at a specific time, but after testing it many times, I've yet to get it to run.

I did a crontab -e in the terminal Got the working directory of my CakePHP application via navigating to my applications root and copy/pasting the output of the "pwd" command.

My crontab -e looks like this

ex) this is what i had for a test run

32 06 * * * cd /home/danielparkk/Desktop/SubReminder && bin/cake message360

Is there something wrong with how I'm doing this?

Aucun commentaire:

Enregistrer un commentaire