CronJob未运行CakePHP3
在我的CakePHP3应用程序中,我有一个名为Message360的shellCronJob未运行CakePHP3,php,cakephp,cron,Php,Cakephp,Cron,在我的CakePHP3应用程序中,我有一个名为Message360的shell namespace App\Shell; use Cake\Console\Shell; use Cake\I18n\Time; class Message360Shell extends Shell { public function initialize() { parent::initialize(); $this->loadModel("Subsc
namespace App\Shell;
use Cake\Console\Shell;
use Cake\I18n\Time;
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 \Message360Api\Lib\Message360;
$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();
}
}
我已经删除了很多实际的代码,因为它与问题无关
当我通过bin/cake message360手动运行Shell时,它可以很好地运行主功能
然而,我安装了CronTab以便在特定时间运行它,但是在多次测试之后,我还没有让它运行
我在终端上做了一个crontab-e
通过导航到我的应用程序根目录并复制/粘贴“pwd”命令的输出,获得了我的CakePHP应用程序的工作目录
我的crontab-e看起来像这样
这是我试运行时所用的
32 06***cd/主页/丹尼尔帕克/桌面/子提醒和bin/蛋糕信息360
我这样做有什么问题吗?您在
蛋糕消息360
中真的有空间吗?如果是这样,那么您需要引用整个路径。您的意思是我需要message360 shell本身的工作目录?message360是您传递给cake的参数吗?它是shell的名称,我正在服务器和您的cakephp应用程序上运行一个名为main.read error logs的方法。在运行cron时设置电子邮件通知,然后您可以查看设置中的错误位置和原因