2

I am trying to run cron job in my laravel 5.2 application hosted in goDaddy shared host.

I have cPanel access and there I added a cron job, something like this:

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

But the issue is that the server is not calling schedule action in Kernel.php. The same works fine in my local system.

Can anyone point out the mistake please or suggest some way to accomplish this so that server runs the cron job so as to execute defined commands.

  • Possible duplicate of [cronjob does not execute a script that works fine standalone](http://stackoverflow.com/questions/36885909/cronjob-does-not-execute-a-script-that-works-fine-standalone) – fedorqui Aug 02 '16 at 07:57

3 Answers3

4

Add path of php binary to cron command.

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

Example : /usr/bin/php

Lakin Mohapatra
  • 1,097
  • 11
  • 22
2

Cpanel Cron job command in laravel godaddy and others are same

/usr/local/bin/php /home/ivlssadmin/public_html/inventoryproject/artisan OpeningStocks:openingstocks >> /dev/null 2>&1

Here what you change follow bellow :

/usr/local/bin/php /home/Your Host User Name /public_html/Sub Domain Name/artisan Command Name:Command Name >> /dev/null 2>&1

if you don't have sub domain you write only public html

Jasim Juwel
  • 736
  • 8
  • 19
1

Make sure you write the correct command in the schedule action. e.g. $schedule->command('send:followup')

Also check the timezone of the crontab if possible are you using utc timezone in your commands this is the default for most servers.

Theed
  • 11
  • 1
  • 3