WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Google XML Sitemaps] Rebuilding sitemap via cron not working (7 posts)

  1. ericr23
    Member
    Posted 5 years ago #

    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.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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.

  3. ericr23
    Member
    Posted 5 years ago #

    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."

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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.

  5. microkid
    Member
    Posted 5 years ago #

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

  6. JeanPaulH
    Member
    Posted 5 years ago #

    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

  7. Three-Star Dave
    Member
    Posted 5 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic