I
I
Ivan2020-08-03 12:24:08
Laravel
Ivan, 2020-08-03 12:24:08

How to run laravel task scheduler?

Added a task like this to the app/Console/Kernel.php file:

protected function schedule(Schedule $schedule)
    {
        $schedule->call(function () {
            // some code
        })->everyMinute();
    }
for the test set every minute. The scheduler started so:
php artisan schedule:run >> /dev/null 2>&1
The task at start works, but then already does not work. If you enter the command , the
php artisan schedule:run
task also works. What am I doing wrong? It should be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanes, 2020-08-03
@Djonson86

There should be a job in the cron scheduler

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

Where snowflakes mean repeat every minute.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question