I'm trying to set up the Laravel 11 scheduler on my O2Switch hosting.
Here's the line declared in my crontab.
* * * * * cd link_to_project && php artisan schedule:run >> /dev/null 2>&1
When I run the scheduler via the crontab the return of the command is as if I just did scheduler:list
instead of the real scheduler:run
.
EDIT :
I put this line in the crontab:
* * * * * cd link_to_project && php artisan schedule:run >> /dev/null 2>&1
And that's how I could see that the return of the command looked like a schedule:list
instead of a schedule:run
.
I've already had the same problem with an O2Switch server. Here's how to solve your problem.
In your crontab, you need to specify the full path of PHP as well as the absolute path of your project.
* * * * * /usr/local/bin/php /home/NAME/link_to_project/artisan schedule:run >> /dev/null 2>&1
This will allow the cron job to run normally.