0

I have a Laravel 5 application where i want to run cronjobs, i have created a command, that will be running every 5 minutes.

But for some reason it´s never called.

I have added the following crontab.

*   *   *   *   *   php /var/www/vhosts/website.com/httpdocs/artisan schedule:run

I checked the cron log file, and it looks like it´s running:

Apr 15 10:19:01 lvps92-51-xx-xx CROND[15420]: (root) CMD (php /var/www/vhosts/website.com/httpdocs/artisan schedule:run)

But it is never calling the command. The funny thing is that if i run the command manually its working...

[root@lvps92-51-xx-xx /]# php /var/www/vhosts/website.com/httpdocs/artisan schedule:run    
Running scheduled command: (touch /var/www/vhosts/website.com/httpdocs/storage/framework/schedule-c56ad4a76ba9d8e31def649e20c42f73; /usr/local/php566-cgi/bin/php artisan test:run; 
rm /var/www/vhosts/website.com/httpdocs/storage/framework/schedule-c56ad4a76ba9d8e31def649e20c42f73) > /dev/null 2>&1 &

There is no logging entries in the Laravel Log.

(I know that i run the cronjob as root, but that was to avoid permissions errors doing testing)

Laravel version: 5.0.27
Server: Centos 6

What am i missing?

2 Answers 2

4

I also had this problem few days ago and this is how I solved it. I am actually using hostmonster for hosting my application. My cron job runs every minutes.

*   *   *   *   *   /usr/local/bin/php path/to/artisan schedule:run 1>> /dev/null 2>&1

Hope this helps

Sign up to request clarification or add additional context in comments.

Comments

3

Found out what was wrong, i have more than 1 PHP version installed and for some reason cron is using the default php installation even when i have added the new PHP path to .bash_profile.

I fixed it by adding path to the right PHP version:

*   *   *   *   *   /usr/local/php566-cgi/bin/php /var/www/vhosts/website.com/httpdocs/artisan schedule:run 1>> /dev/null 2>&1 

That way its forced to run with that PHP version.

1 Comment

Can you share what makes the he two PHP version cause the schedule:run not to run?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.