1

I've searched everywhere and just can't seem to find the correct answer. I'm a complete novice when it comes to cron jobs! (However I do understand the principle behind them)

I'm running Magento 2.0.6 and I need to reindex - however I do not have SSH access and can't do anything through CLI. I do have access to cPanel and it's corresponding Cron Job utility. I was just wondering if anyone could tell me the exact command I need to pass to this utility?

These are my attempts at the cron jobs that I sourced from the Magento Documentation: (Does not work)

/usr/bin/php -c /usr/local/lib/php.ini /bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/log/magento.cron.log

/usr/bin/php -c /usr/local/lib/php.ini /update/cron.php >> /var/log/update.cron.log

/usr/bin/php -c /usr/local/lib/php.ini /bin/magento setup:cron:run >> /var/log/setup.cron.log

Can any one give me final solution which working

1

First you nee get root folder for you project, see http://support.hostgator.com/articles/cpanel/what-is-a-document-root-folder

than you can run cron as

cd /path/to/magento/root && env php bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/log/magento.cron.log
cd /path/to/magento/root && env php update/cron.php >> /var/log/update.cron.log
cd /path/to/magento/root && env php bin/magento setup:cron:run >> /var/log/setup.cron.log
  • The magento structure is located at the root. Does that mean I can leave out everything before the "env php"? – Mark Coetzer May 19 '16 at 15:42
  • no, you should still write cd / && ... – KAndy May 19 '16 at 16:04
  • cron jobs run in the home directory of the invoking user. They can change from there with cd obviously, but that's the default. – tripleee May 9 '17 at 4:36
0

Try like this:

/usr/local/php55/bin/php-cli /public_html/domain.com/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/log/magento.cron.log

Use cli path and give full path if that is from /home/username/public_html/domain.com/bin/magento cron:run

0

I have the same problem, my crons are in Cpanel of my hoster but reindex and sitemap.xml are not done by magento.

My hoster checked the cronjobs and said they work and it is all good. They look like this:

/usr/local/bin/php -c /opt/alt/php56/etc/php.ini /home/zizzowa1/public_html/bin/magento cron:run >> /home/zizzowa1/public_html/var/log/magento.cron.log&


/usr/local/bin/php -c /opt/alt/php56/etc/php.ini /home/zizzowa1/public_html/update/cron.php >> /home/zizzowa1/public_html/var/log/update.cron.log&


/usr/local/bin/php -c /opt/alt/php56/etc/php.ini /home/zizzowa1/public_html/bin/magento setup:cron:run >> /home/zizzowa1/public_html/var/log/setup.cron.log&

Does yours work now?

0

I Have finally cracked it for cpanel... my correct configuration was:

* * * * * /usr/bin/php-cli /home/(((((FTP USERNAME))))/public_html/bin/magento setup:cron:run >> /home/(((((FTP USERNAME))))/public_html/var/log/setup.cron.log     

* * * * * /usr/bin/php-cli /home/(((((FTP USERNAME))))/public_html/update/cron.php >> /home/(((((FTP USERNAME))))/public_html/var/log/update.cron.log   

* * * * * /usr/bin/php-cli /home/(((((FTP USERNAME))))/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/(((((FTP USERNAME))))/public_html/var/log/magento.cron.log

After hours of trying wooop woop!

I hope it works for other cpanel users!

  • (((((FTP USERNAME)))) <----- Swap this for your user name – Daniel Jan 1 '17 at 16:29
  • /home/(((((FTP USERNAME))))/public_html/bin/magento setup:cron:run <-- which path?? – Magento2 Devloper Jun 22 '17 at 19:26
  • also >> /home/(((((FTP USERNAME))))/public_html/var/log/setup.cron.log which path? – Magento2 Devloper Jun 22 '17 at 19:27
  • For security reason, you MUST not put Magento in /public_html/ – KAndy Oct 1 '17 at 11:24
0

For anyone using Magento 2.2.0, an installation command is bundled with the bin/magento tool:

php bin/magento cron:install

In cPanel you can view the crons created via the "Cron Jobs" area, which would be the same result as if you'd created them from that area yourself.

-3

You should check three things:

  • sudo service cron status to check if the service is running on the server

  • ls -la and check if your files user & group are the same as the one you configured on the cron crontab -u xxx -e

  • select * fron cron_schedule and check if the table is being populated.

  • 2
    Please read up on the rules on self-promotion: The community here tends to vote down overt self-promotion and flag it as spam. Post good, relevant answers, and if some (but not all) happen to be about your product or website, that’s okay. However, you must disclose your affiliation in your answers. All your Magento posts seem quite useful, but they contain an (undisclosed) link to your website. – Glorfindel Mar 31 '17 at 18:57
  • 2
    To elaborate on what "disclose" means -- "this guide" implies it's one you just found. "this guide I wrote" makes it explicitly clear that it's yours. "this guide on my blog" is the best, though, because it makes it clear that (a) the content was created by you (or, if not, it'll list whose content it is on the blog, right?) and (b) makes it clear that the hosting site is yours as well. If you don't follow this requirement, your posts are considered spam, and could end up deleted. – Fund Monica's Lawsuit Mar 31 '17 at 18:58

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.