Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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/tjhillard/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.

like image 552
TJH Avatar asked Jan 28 '17 03:01

TJH


1 Answers

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

* * * * * php /Users/myusername/Projects/projectname/artisan schedule:run >> /dev/null 2>&1
like image 57
Saumini Navaratnam Avatar answered Sep 27 '22 16:09

Saumini Navaratnam