如何在nginx vps中运行laravel调度程序

发布于 2025-01-30 15:16:55 字数 522 浏览 5 评论 0原文

嗨,我想

在kernel.php中

protected function schedule(Schedule $schedule)
{
 $schedule->job(function (){
            $run= new [ ControllerName() ];
            $run->index();
 })->everyMinute();
}

使用VPS(Linux Ubunto 20.04 nginx)中运行Laravel Scheduler,然后在VPS中的项目位置中在终端中运行此命令(PHP Artisan计划:运行);

我得到[2022-05-20T15:33:06+04:30]运行计划的命令:app \ http \ controllers \ crawlerController

nothig this:/ nothig happend:/

我该怎么办?

hi i want to run laravel scheduler in vps (linux ubunto 20.04 nginx)

in Kernel.php

protected function schedule(Schedule $schedule)
{
 $schedule->job(function (){
            $run= new [ ControllerName() ];
            $run->index();
 })->everyMinute();
}

then i run this command in terminal (php artisan schedule:run) in project location in vps;

i get [2022-05-20T15:33:06+04:30] Running scheduled command: App\Http\Controllers\CrawlerController

this but nothig happend :/

what can i do to fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千里故人稀 2025-02-06 15:16:55

在您的服务器中打开crontab -e并在代码下面粘贴,不要忘记更改cd/var/www/testproject等途径项目。

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

open crontab -e in your server and paste below code and don't forget to change path-to-your-project like cd /var/www/testproject.

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文