WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Google XML Sitemaps] Rebuilding sitemap via cron not working

[Plugin: Google XML Sitemaps] Rebuilding sitemap via cron not working

  • ericr23
    Member

    @ericr23

    The manual GET request works when I run it myself in the browser.

    But does not work when I run it as a cron task, with either

    wget http://www.domain.org/?sm_command=build&sm_key=...

    or

    curl http://www.domain.org/index.php -d sm_command=build -d sm_key=... -g

    Both commands successfully connect to the page, but the sitemap is not rebuilt.

    Please help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Samuel Wood (Otto)
    Keymaster

    @otto42

    You cannot run it as a cron that way, because it uses a nonce. A nonce is a special code that only works one time. So that URL you have only works once. It changes every so often.

    Anyway, you don’t need to rebuild the sitemap unless something on the site changes. And when that happens, the plugin rebuilds automatically. So skip the cron idea, it’s not necessary.

    ericr23
    Member

    @ericr23

    But I have had the same URL as a link on an “update” page for quite some time, and it always works.

    And according to Arnee himself, “With wget and crontab it should be no problem to build the sitemap every night.”

    Samuel Wood (Otto)
    Keymaster

    @otto42

    Ahh, you’re using the other link, not the “rebuild your sitemap” link. I see. Sorry, my bad, I thought that link had a nonce in it.

    Well, in that case, you’ll need to take it up with Arnee directly then.

    Try adding the -G option to the curl command to force a GET request instead of the default POST method.

    If someone (like me) is looking for the solution, please try this:
    curl -G -s -S http://www.example.com/index.php -d sm_command=build -d sm_key=XXXXXXXXXXXXXXXXXXXXXXXX

    Three-Star Dave
    Member

    @three-star-dave

    Okay, I have in my cron manager …

    curl -G -s -S http://mydomain.com/blog/index.php -d sm_command=build -d sm_key=xxxxxxxxxxxxxxxxx

    … as specified above. When I run a rebuild from the WP Admin panel, it runs fine to completion.

    When I run the rebuild through curl, it doesn’t throw an error in my email log (runs about 150 seconds), but the rebuild times out after 300 seconds at various points.

    I can bump up resources, but I’m not sure why there’s a difference running the curl job. Are the resource options applying in one case and not the other?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Google XML Sitemaps] Rebuilding sitemap via cron not working’ is closed to new replies.