0

I am working on a Laravel project and have created a command with signature 'process:pending-reports'.

When I run this using: php artisan process:pending-reports, it does the needful i.e. the script gets executed.

I have now added this to the schedule() method inside app/Console/Kernel.php file as so:

protected function schedule(Schedule $schedule)
    {
        $schedule->command('process:pending-reports')->everyFifteenMinutes();
    }

When I check the details using: php artisan schedule:list I again get the expected output like:

 */15 * * * *  php artisan process:pending-reports ................................................................................................... Next Due: 7 minutes from now 

However, once the time for command execution passes, it does not actually run the command.

What am I missing?

2 Answers 2

1

The Laravel Scheduler must be added to the crontab:

you can edit it using the command:

crontab -e

then add a line like this:

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

Here is the reference

Sign up to request clarification or add additional context in comments.

1 Comment

On windows there's an equivalent way to do this using the task scheduler
1

Command php artisan schedule:list just listing your scheduled task, not running the task.

For running scheduled task on local development, you can use command php artisan schedule:work. This command will run in the foreground and invoke the scheduler every minute until you terminate the command.

source: Laravel Task Scheduling

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.