猿问

在 cron 中将 laravel 命令作为 shell 命令执行

我正在使用 cPanel 创建一个 cron ,如下所示:


* * * * * /home/elsdqscy/folder/update_db.sh > update_db.txt

在我的 shell 文件中,我有:


#!/bin/bash


cd folder && php artisan migrate:fresh --seed --force

这应该可行,因为知道该命令/home/elsdqscy/folder/update_db.sh在终端中有效。


我确实在输出文件中收到此错误:


In ArgvInput.php line 246:

                                           

  Invalid argument supplied for foreach()  


Content-type: text/html; charset=UTF-8

知道我做错了什么吗?


呼啦一阵风
浏览 239回答 3
3回答

慕盖茨4494581

您还需要提供 shell 文件内的完整路径,如下所示:cd folder && /usr/bin/php artisan migrate:fresh --seed --force

哔哔one

运行调度程序* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

慕雪6442864

你试过了吗* * * * * cd /home/elsdqscy/folder/update_db.sh > update_db.txt
随时随地看视频慕课网APP
我要回答