Magento google sitemap and cron

2019-08-11 17:14发布

问题:

I am having trouble getting the Google Sitemap to automatically generate. Here’s what I have done to enable it:

  • Have an hourly cron that runs (cron.sh, that runs) cron.php

  • Set System->Configuration->Google Sitemap->Generation Settings->Enabled to “Yes”

  • Created a Google Sitemap in Catalog->Google Sitemap

When I manually generate the sitemap, it works great. The cron is also working without errors. Am I missing a step?

回答1:

To setup cronjob

  • Add cronjob to Linux server. Either via SSH or via directadmin. I let it run every 30 minutes.

*/30 * * * * /home/shirts01/public_html/cron.sh

  • Go to your magento root where cron.sh is found. Via SSH execute

chmod +x cron.sh

  • Go to app/code/core/Mage/. Here you can find alle the automated sections. Read this article and below you can find how and what you can plan. Be aware that these elements are all found in het /etc folder in config.xml under a section like app/code/core/Mage/CatalogRule/etc/config.xml: (here it is CatalogRule)

    http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job

<crontab>
<jobs>
  <catalogrule_apply_all>
      <schedule><cron_expr>0 1 * * *</cron_expr></schedule>
      <run><model>catalogrule/observer::dailyCatalogUpdate</model></run>
  </catalogrule_apply_all>
</jobs>
</crontab>
  • Go to the rigth file and lookup for the words CRON. Mostly you will find the elements are already defined. Here you can alter to your wishes.

  • For sitemap do the same as above. But also look for the word ENABLE in the config.xml. This has to be set to 1 (and defaults to 0)

        <generate>
            <enabled>1</enabled>
            <error_email><![CDATA[]]></error_email>
            <error_email_template>sitemap_generate_error_email_template</error_email_template>
            <error_email_identity>general</error_email_identity>
        </generate>

Hope this helps



标签: magento