Laravel 5.7通过cron在AWS EC2 Linux ami AMI上调度-命令未运行

时间:2019-01-20 11:38:03

标签: laravel amazon-web-services amazon-ec2

我已经在AWS EC2中创建了一个cron作业,但是它不能在计划的时间工作。当我在cli ==9329== Memcheck, a memory error detector ==9329== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==9329== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info ==9329== Command: ./a.out ==9329== ./.X0-lock : 11 ./a.out : 12920 ./f.c : 2485 ./vgdb-pipe-shared-mem-vgdb-9329-by-pi-on-??? : 36 ==9329== ==9329== HEAP SUMMARY: ==9329== in use at exit: 0 bytes in 0 blocks ==9329== total heap usage: 35 allocs, 35 frees, 339,242 bytes allocated ==9329== ==9329== All heap blocks were freed -- no leaks are possible ==9329== ==9329== For counts of detected and suppressed errors, rerun with: -v ==9329== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 3) 中运行命令时,它可以正常工作,但不能在计划的时间自动执行。

php version = 7.2.11

laravel框架= 5.7

我使用php artisan schedule:run在crontab中添加了cron条目

crontab -e

这是我的核心文件

* * * * * /usr/local/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1

1 个答案:

答案 0 :(得分:2)

根据我们的评论,问题出在您的PHP可执行文件的路径上。在您的cron作业定义中,路径错误。更改为:

* * * * * /usr/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1

假设artisan可执行文件位于/var/www/html处,应该可以对其进行修复。

如果不确定该路径是否正确,可以从项目根目录(工匠所在的位置)键入pwd,以获取指向工匠可执行文件的正确路径。