user3271960
user3271960

Reputation:

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.

Upvotes: 5

Views: 11580

Answers (2)

Boss COTIGA
Boss COTIGA

Reputation: 1042

Under 10.13 (High Sierra) the only command that worked is:

* * * * * /usr/local/bin/php /Users/USER_NAME/PROJECTS_PATH/PROJECT/artisan schedule:run >> /dev/null 2>&1

Upvotes: 1

Saumini Navaratnam
Saumini Navaratnam

Reputation: 8880

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

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

Upvotes: 13

Related Questions