Problem with cron and command laravel 5.6

1

I am scheduling mailings by command in laravel. When I include the execution in my cron file, it is executed in the frequency indicated in the cron and not in the indicated schedule of my command

   En el cron:::::
    * * * * * php /var/www/test-gestionventa/artisan sms:birthday 1>> /dev/null 2>&1


  En mi class Kernel:::::::
  protected function schedule(Schedule $schedule)
   {
    $schedule->command('sms:birthday')->everyFiveMinutes();
   }

How do I make the cron run every 5 minutes as indicated in my class and not every minute as it is in cron? without having to specify the same frequency (every 5 minutes) in cron

Thank you.

    
asked by Virginia 29.08.2018 в 17:20
source

1 answer

2

You do not have to program a cron on the server to do a specific task, the cron that the server has to run is this:

* * * * * php /ruta-hacia-tu-artisan/artisan schedule:run >> /dev/null 2>&1

Once this cron is programmed in the server, you can declare the crons where you comment in the app \ Console \ Kernel.php file.

  protected function schedule(Schedule $schedule)
   {
    $schedule->command('sms:birthday')->everyFiveMinutes(); //se ejecutara cada 5 mins
    $schedule->command('sms:otro')->daily(); //se ejecutara diariamente
   }
    
answered by 29.08.2018 / 21:13
source