wiesson
wiesson

Reputation: 6822

Laravel command in cronjob will not executed correctly

I've edited the crontab (centos) like this:

0 6 * * * php /var/www/site/artisan eex --update=true

The crontab (/var/log/cron) shows that the command has been executed successfully:

Dec 10 06:00:01 yyy CROND[19946]: (user) CMD (php /var/www/site/artisan eex --update=true)

However, the database has not been updated. If I start the command manually, it works fine:

[user@yyy energiems]$ php /var/www/site/artisan eex --update=true
> Updated 1 element(s) (43f70960-772c-11e4-92a4-57928d74f84f)
(...)
> Updated 1 element(s) (43fd1470-772c-11e4-b1f2-b58d1e3307a3)

Any ideas?

//edit: In addition to Dwights answer, I also noticed, that the cronjob runs in the wrong timezone. I've adjusted it to Germany and it works fine now.

Upvotes: 1

Views: 599

Answers (1)

Dwight
Dwight

Reputation: 12450

Find out where the location of php is on your server with the which php command.

Then, update your crontab to reference php at it's precise location.

Odd solution I know, but I had a similar issue and this turned out to be the fix.

Upvotes: 2

Related Questions