https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44314 --- Comment #2 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 212746 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212746&action=edit Bug 44314: Make koha-sitemap report failures and process all instances koha-sitemap runs with 'set -e', so a failing generate_sitemap call ended the script right there, without processing the remaining instances. This also happened, with exit status 1, for instances that don't have sitemap generation enabled when --quiet is used: the function ended with '[ "$quiet" = "no" ] && warn ...', which returns 1. As a result, the natural cron job koha-sitemap --quiet --generate $(koha-list --enabled) stopped at the first instance without sitemaps enabled. This patch: * Makes generate_sitemap return 0 for instances without sitemap generation enabled (not an error). * Keeps processing the remaining instances when generation fails for one of them, and exits with status 1 at the end if any failed (0 otherwise). * Reports each failure on stderr ("Error: sitemap generation failed for <instance>"), also with --quiet, which is meant to silence notices, not errors. * Documents the exit status in the man page. Test plan: 1. Apply this patch 2. Enable sitemaps for the instance and generate them: $ ktd --shell k$ sudo koha-sitemap --enable kohadev k$ sudo bash debian/scripts/koha-sitemap --quiet --generate kohadev ; echo "exit=$?" => SUCCESS: exit=0, /var/lib/koha/kohadev/sitemap/sitemapindex.xml exists 3. Make generation fail (a directory where the sitemap file should go) and repeat the command, listing the instance twice: k$ sudo rm -f /var/lib/koha/kohadev/sitemap/*.xml k$ sudo mkdir /var/lib/koha/kohadev/sitemap/sitemap_0001.xml k$ sudo bash debian/scripts/koha-sitemap --quiet --generate kohadev kohadev ; echo "exit=$?" => SUCCESS: "Error: sitemap generation failed for kohadev" is shown twice (both are processed) and exit=1 4. Disable sitemaps and generate with --quiet: k$ sudo koha-sitemap --disable kohadev k$ sudo bash debian/scripts/koha-sitemap --quiet --generate kohadev ; echo "exit=$?" => SUCCESS: No output, exit=0 (on main: exit=1) 5. Clean up: k$ sudo rm -rf /var/lib/koha/kohadev/sitemap 6. Sign off :-D Assisted-by: Opus 5.5 (Anthropic) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.