在HPANE(Hostinger -Cron Job)上运行Laravel任务计划
如运行调度程序我必须运行此命令:
* * * * * cd /home/u285707107/domains/dmn.com/ && php artisan schedule:run >> /dev/null 2>&1
但是在hpanel cron job-s中,我无法使用特殊字符,所以我创建 cron.sh file as 在Hostinger Cron Job I命令中,如何运行're =“ nofollow noreferrer”>在hostinger cron of in
#!/bin/sh
/home/u285707107/domains/dmn.com/ && php artisan schedule:run > /dev/null 2>&1
Commant I命令:
/bin/sh /home/u00000000/domains/dmn.com/public_html/dmn/app/Console/cron.sh
但是它不don' t工作:(
我的 kernel.php 文件是:
<?php
namespace App\Console;
use App\Models\Proview;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
protected function schedule(Schedule $schedule){
$schedule->call(function () {
Proview::query()->update(['today' => 0]);
})->everyMinute();
}
protected function commands(){
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
有人可以帮我吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不需要bash文件,只需创建一个PHP脚本文件(.php),然后使用脚本“ PHP”类型设置CRON作业,
应该是:
对于Cron作业
You don't need bash file for this, just create a php script file (.php) and set the cron job using the type "php"
the script should be :
for the cron job
只需用您的脚本替换以下脚本即可。
cron.sh
hostinger cron job
Just replace the below scripts with yours.
cron.sh
Hostinger Cron Job