Search code examples
phplaravelcroncpanellaravel-8

Creating Cron Job on cPanel for Task Scheduling in Laravel


Pretty much the title. I am doing it as it says in the docs but it won't work. No log updates in laravel.log file either which might have helped. This is how I set up my cron job:

enter image description here

I also gave it my mail address where it should send the log of the job and it sometimes does do that but sometimes doesn't which I didn't quite understand why. Anyway, the mail content was simply what Laravel says when you type php artisan in the terminal. Like it shows you all the commands of Laravel.

Any idea why it doesn't work and how to fix it? Thanks!


Solution

  • You should to change the line of command to this:

       /usr/local/bin/php /home/cpanel-user/laravel-app/artisan schedule:run >> /dev/null 2>&1