How to create a calendar task with laravel [duplicate]

0

I'm trying to work with cron for the first time and trying to create a very simple scheduled task.

I was looking at the documentation and saw that this command needs to be executed

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

I ran it in the terminal like this:

* * * * * php /var/www/html/mail-with-cron schedule:run >> /dev/null 2>&1

with the directory of my project and then I gave php artisan serve

but he did not run the inspire command

    
asked by anonymous 07.04.2017 / 15:29

2 answers

0

This is not a command that runs on the terminal. You need to put this command in the cron of your server. To do this execute in the terminal crontab -e

A file will be opened. Here you put the crontab definition.

* * * * * php /var/www/html/artisan schedule:run >> /dev/null 2>&1

This will execute all the commands defined in method schedule in app/Console/Kernel.php

protected function schedule(Schedule $schedule)
{
    $schedule->command('inspire')
             ->hourly();
}
    
18.11.2017 / 01:02
-1

Missed the artisan at the end of the directory, so it looks like this:

* * * * * php /var/www/html/mail-with-cron/artisan schedule:run >> /dev/null 2>&1
    
18.04.2017 / 01:21