0

I have read all I could find about configuring the Magento 2 Cron jobs, and this is what I did:

crontab -u <myself> -e

And then added:

*/1 * * * * /opt/php/bin/php /web/bin/magento cron:run
*/1 * * * * /opt/php/bin/php /web/update/cron.php
*/1 * * * * /opt/php/bin/php /web/bin/magento setup:cron:run

But it doesn't seem to be working...

/opt/php/bin/php 

is what I get when I run

which php

but when I run

whereis php

I get

/usr/share/man/man1/php.1

Which one should I use as the < path to php binary >?

Am I missing anything else?

Thanks!

0

If you're able to check the database, check the cron_schedule table in the messages field as this will tell you the return value of the cron task and what exception it returns (If any)

You can also log the cron output to a log file to ensure it's getting run correctly like so:

* * * * * /usr/bin/php /path/to/magento/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /path/to/magento/var/log/magento.cron.log * * * * * /usr/bin/php /path/to/magento/update/cron.php >> /path/to/magento/var/log/update.cron.log * * * * * /usr/bin/php /path/to/magento/bin/magento setup:cron:run >> /path/to/magento/var/log/setup.cron.log

My which php returns /usr/bin/php (Same as my crontab) so I'd stick with your /opt/php/bin/php but review the logs and database table as I mentioned above to see if anything else is being returned.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.