6

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!

John Conde
  • 217,595
  • 99
  • 455
  • 496
Mauro
  • 361
  • 1
  • 4
  • 14
  • 2
    I'm afraid something's lost in the translation — why would generating a site map update config.xml? – Alana Storm May 18 '12 at 15:18
  • Well.. I've followed this post: http://stackoverflow.com/questions/9175563/magento-google-sitemap-and-cron Is it correct to edit che .xml config, or as I've understood, .xml is just used for default values? – Mauro May 18 '12 at 18:54
  • Mauro, once the config values are in the database, they supersede all data stored in the XML files. The cron can run every 10 minutes, but the actaul trigger for the sitemap would only trigger when it is scheduled in Magento, hour, minute, etc. – Vern Burton May 18 '12 at 19:58

3 Answers3

7

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.

Fiasco Labs
  • 6,457
  • 3
  • 32
  • 43
  • Edit from -- to the end is made by me, just for uploading the image of Cron Monitor. Thanks! – Mauro May 19 '12 at 07:16
  • I can also confirm that now it works :| After switching from cron.php to cron.sh ... Thank you very much! – Mauro May 19 '12 at 07:22
2

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
Seth Malaki
  • 4,436
  • 23
  • 48
  • Already done, but schedule is activated on cron.php instead of cron.sh (and I'm sure it's working, every 1o mins). But Sitemap is not updating automatically – Mauro May 18 '12 at 18:48
1

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

Vern Burton
  • 3,215
  • 1
  • 18
  • 31
  • My crontab is set up correctly... with cPanel! I've enabled the cron.php to be execute every 10 mins (and it works, since I've edited the PHP code adding, at the bottom, some lines with email sending, to check if the file is correctly scheduled).... I've then replaced with the original cron.php file. Anyway... it's not updating the sitemap. Don't know why :( – Mauro May 18 '12 at 18:46
  • you should be using the sh version, as it has logic to stop multiple runs of itself, when is the sitemap scheduled to run, the cron runs every 5 or 10 minutes in your solution and just asked Magento if anything is due to run since the last check, so the sitemap would need to be scheduled every 5 minutes not just the cron. – Vern Burton May 18 '12 at 19:00