On pe, 2011-05-06 at 10:07 +0200, Holger Levsen wrote:
> during a test with piuparts I noticed your packages cronjob exits with 
> error (and has output) after the package has been removed. 
> 
> From the attached log (scroll to the bottom...):
> 
> 1m1.4s INFO: Running scripts post_remove
> 1m1.4s INFO: Package ikiwiki-hosting-web contains cron file: 
> /etc/cron.daily/ikiwiki-hosting-web
> 1m1.4s DEBUG: Starting command: ['chroot', 
> '/org/piuparts.debian.org/tmp/tmpKrBNnA', '/etc/cron.daily/ikiwiki-hosting-
> web']
> 1m1.4s DUMP: 
>   ionice: execvp failed: No such file or directory
>   ionice: execvp failed: No such file or directory
>   /etc/cron.daily/ikiwiki-hosting-web: 10: ikisite-delete-unfinished-site: 
> not 
> found
> 1m1.4s ERROR: Command failed (status=127): ['chroot', 
> '/org/piuparts.debian.org/tmp/tmpKrBNnA', '/etc/cron.daily/ikiwiki-hosting-
> web']
>   ionice: execvp failed: No such file or directory
>   ionice: execvp failed: No such file or directory
>   /etc/cron.daily/ikiwiki-hosting-web: 10: ikisite-delete-unfinished-site: 
> not 
> found

This would be piuparts running the cron script directly, if I'm
understanding things correctly. (That's a new feature. Cool.)

Also, the cron script gets run after the package has been removed, and
before it is purged. So the problem is that ikiwiki-hosting-web-daily
and the other ikiwiki commands are not installed. Ergo, the cron script
should test for them being there, before doing anything?

Assuming that's correct, patch attached.
--- debian/ikiwiki-hosting-web.cron.daily.orig	2011-05-06 23:36:50.000000000 +0100
+++ debian/ikiwiki-hosting-web.cron.daily	2011-05-06 23:41:58.000000000 +0100
@@ -1,11 +1,19 @@
 #!/bin/sh
 # Compact and maintain all sites. This is a low-priority background job.
 # It can be a bit noisy, so chronic is used to only show output on error.
-nice -n 19 ionice -c 3 chronic ikiwiki-hosting-web-daily
+if command -v ikiwiki-hosting-web-daily > /dev/null
+then
+    nice -n 19 ionice -c 3 chronic ikiwiki-hosting-web-daily
+fi
 
 # Backup sites once a day.
-nice -n 19 ionice -c 3 chronic ikiwiki-hosting-web-backup
+if command -v ikiwiki-hosting-web-backup > /dev/null
+then
+    nice -n 19 ionice -c 3 chronic ikiwiki-hosting-web-backup
+fi
 
 # Clean up unfinished sites. This produces output you probably want to see.
-ikisite-delete-unfinished-site --all
-
+if command -v ikisite-delete-unfinished-site > /dev/null
+then
+    ikisite-delete-unfinished-site --all
+fi

Reply via email to