Magento google sitemap and cron

magento

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?

Best Answer

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

<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

Related Topic