Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento and Google Sitemap - Cron

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!

like image 481
Mauro Avatar asked May 18 '12 14:05

Mauro


3 Answers

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.

like image 157
Fiasco Labs Avatar answered Nov 15 '22 10:11

Fiasco Labs


I don't see it mentioned on your question but, for cron jobs to work you have to setup the actual cron job for your magento install. Try adding either cron.php or cron.sh first to your crontab:

Example: cron.sh

*/5 * * * *  /bin/sh /absolute/path/to/magento/cron.sh
like image 22
Seth Malaki Avatar answered Nov 15 '22 09:11

Seth Malaki


Mauro,

XML like that is only the default data, once saved in the admin, goes to the database and that is the end all source from there on, see SELECT * FROM core_config_data WHERE path LIKE "sitemap/generate/time"; for the run time, or SELECT * FROM core_config_data WHERE path LIKE 'sitemap/%'; for a overall view of all that options that have been set for sitemap generation in Magento.

As also noted by Seth, you will need to have,

*/5 * * * * /bin/sh /absolute/path/to/magento/cron.sh

in your webusers' crontab

like image 29
Vern Burton Avatar answered Nov 15 '22 10:11

Vern Burton