【发布时间】:2021-05-02 00:38:19
【问题描述】:
我已经制定了一个命令,并安排为每 30 分钟一次。当我运行php artisan schedule:run 时,它工作得非常好并返回预期的结果,但是当我在我的实时服务器上配置它时,我的 cron 作业确实运行了,但它没有重新调整成功消息,而是返回我的 laravel 项目中所有可用命令的列表.这就是我正在做的事情。
命令内核:
$schedule->command('update:callLogs')
->everyMinute();
Cron 条目:
/usr/bin/php /home/ddsas9rm2f1g/public_html/clowdlink.com/crm/artisan schedule:run
这是我得到的回应
Laravel 框架 5.8.38
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
(List of all availabe commands)
任何帮助将不胜感激。
编辑 现在我的命令看起来像这样
* * * * * cd /home/ddsas9rm2f1g/public_html/clowdlink.com/crm && php artisan update:callLogs
但得到相同的响应,而当我复制相同的命令并使用 putty 运行相同的命令时,它工作得非常好。现在已经一个星期了,我仍然坚持这个 cron 事情。
【问题讨论】:
-
你添加了这个
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1 -
是的,我用这个命令试过了,但结果还是一样
-
进入我的 cPanel cron 作业
-
您的本地设置和实时设置不同,操作系统和 PHP 也不同,所以请检查一下
-
听起来您在共享主机上运行。我可以知道你在哪里托管吗?另外我认为您的 PHP 二进制文件可能在其他地方。也许做一个
phpinfo()并找出路径,或者从你的应用程序中回显(new Symfony\Component\Process\PhpExecutableFinder)->find()来找出答案。