I noticed the sitemap was blank when generated by cron.

I could generate it manually ok.

It turns out the XML was there, but the XSL had an invalid path.

When generated via cron that is using the core scripts/drupal.sh to run, the sitemap.xsl path ends up relative to the scripts dir

e.g:

<?xml-stylesheet type="text/xsl" href="/var/www/site/scripts/sitemap.xsl"?>

Adjusting the call to url() to use an absolute URL fixes the issue.

url('sitemap.xsl')

vs

url('sitemap.xsl', array('absolute' => TRUE))

Patch attached.

cheers,

DT

CommentFileSizeAuthor
sitemap.xsl-absolute-url.patch556 bytesdavidwhthomas

Comments

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

Makes sense to me.

dave reid’s picture

What is the exact command you run for this?

davidwhthomas’s picture

The cron command is this one:

cat /etc/cron.d/drupal-site-name
45 * * * * www-data /var/www/public/site/scripts/drupal.sh --root /var/www/public/site/ http://default/cron.php?cron_key=[cron_key]

Where the site is in /var/www/public/site and [cron_key] is the install's private cron_key

DT

davidwhthomas’s picture

Issue summary: View changes

clarity

dave reid’s picture

Status: Reviewed & tested by the community » Closed (works as designed)

You need to run cron with a fully qualified url, http://example.com/cron.php, and not http://default/cron.php.

dave reid’s picture

Issue summary: View changes

add example