0

Dear Stackoverflowers,

I've created 2 Laravel commands, one that clears the db of records, an the other one that sends an email.

If I call them separately they work, and in the app/console/kernel.php file I have this:

protected function schedule(Schedule $schedule)
{
    // minute, hour, day of month, month, day of week
    // *, *, *, *, * elke minuut

    $schedule->command('item:removeChecked')->everyMinute();

    $schedule->command('email:sendList')->everyMinute();
}

So when I run the php artisan schedule:run command, it runs the 2 commands immediately and responds with the following:

Running scheduled command: '/usr/bin/php' 'artisan' item:removeChecked > '/dev/null' 2>&1 &
Running scheduled command: '/usr/bin/php' 'artisan' email:sendList > '/dev/null' 2>&1 &

But then it stops and does nothing.

So my question is how could I get this to work? I cant find any good documentation about this paret of Laravel, probably because it's quite new.

Thanks in advance for helping me.

Theo.

Dirk
  • 3,095
  • 4
  • 19
  • 37

1 Answers1

1

You have to add an cron job.

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

https://laravel.com/docs/5.2/scheduling#introduction

Rémon

  • I just this this: * * * * * php artisan schedule:run >> /dev/null 2>&1 Then I ran this command: php artisan schedule:run, with the same result. No difference – Dirk May 30 '16 at 19:52
  • You can add and crob job with `crontab -e` – Rémon van den Engh May 30 '16 at 20:01
  • When I run crontab -e I get a screen with a lot of ~ characters. What should I do next? Btw this is my first time with cron – Dirk May 31 '16 at 20:31
  • **the path needs to be absolute** I did: /Applications/MAMP/htdocs/list/artisan. Thanks – Dirk Jun 01 '16 at 12:54