Magento and Google Sitemap - Cron

Mauro picture Mauro · May 18, 2012 · Viewed 18.5k times · Source

I'm a newbie in Magento. I'm tring to configure an auto-generated Google Site Map. I've read everywhere how to set up cron job for Magento with cPanel, how to configure from backend and so on.

My current settings: under System -> Configuration -> Google Sitemap -> Generation Settings -> Enabled = YES. I've create the sitemap on Catalog -> Google Sitemap, of course, which I can manually generate without any problem.

But if I check the file /app/code/core/Mage/Sitemap/etc/config.xml it seems to be not updated (different content btw config.xml and backend). It seems also that the last update on filesystem is perormed on 20/04/2012, instead of today. (I've also run the Fluch Magento and Storage Cache)

<generate>
    <enabled>0</enabled>
    <error_email/>
    <error_email_template>sitemap_generate_error_email_template</error_email_template>
    <error_email_identity>general</error_email_identity>
</generate>

Can someone help me out? Thanks!

Answer

Fiasco Labs picture Fiasco Labs · May 19, 2012

On Magento and Cron setups, use cron.sh to do the triggering. Also I believe in Trust but verify which means set up cron and then actually view the cron job output table for proper runs.

Go into your Advanced System Config and set Cron Success History Lifetime and Failure Lifetime both to 1440 so you are monitoring a 24 hour span of time.

You will now be able to see index operations, etc in the time stream. There will be about 300 jobs listed in your Jobs Successful section over the 24 hour timespan.

Now run this cron log monitor to see if your cron really is running. I've run into many times when the person says it is, but then tries to verify it and finds that it pooped out after a couple tries.

The next issue is the statement But if I check the file /app/code/core/Mage/Sitemap/etc/config.xml it seems to be not updated. First, this is a configuration template, it will not update. The enable is done in the database. You check it in System -> Config -> Catalog -> Google Sitemap -> Generation Settings -> Enable = Yes should be the setting and once saved, stays on Yes. Magento consults this setting stored in the database, not the config.xml to actually run the sitemap generation.

Search Engine Optimization - Enable Autogenerated Sitemap

Now if you've got the sitemap properly created under Catalog -> Google Sitemap, the date/time stamp on your actual sitemap.xml file should start updating.