'how to run laravel scheduler in nginx vps

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?



Solution 1:[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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rakeshkumar G G