laravellaravel-5cron

Laravel Task Scheduler Crontab


I can't get my cron working on my local server using Valet. Here's what I've got/done.

  1. When I run php artisan command:mycommand the command runs.
  2. When I run php artisan schedule:run the command runs.

Output:

Running scheduled command: '/usr/local/Cellar/php70/7.0.13_6/bin/php' 'artisan' game:resources > '/dev/null' 2>&1 &

According to the Laravel docs it says to add this to my crontab.

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

When in my project directory, here is the pwd.

/Users/username/Projects/galaxywars

When I try crontab -e in my laravel project root and save this:

* * * * * php /Users/myusername/Projects/projectname schedule:run >> /dev/null 2>&1

... it doesn't work. I've tried several variations of this cron command with no luck. Any idea what I'm doing wrong?

I'm on macOS using Valet.


Solution

  • You have to add artisan add the end of the path. Try

    * * * * * php /Users/myusername/Projects/projectname/artisan schedule:run >> /dev/null 2>&1