The synopsis for koha-foreach looks like this: koha-foreach [--enabled] [--email|--noemail] [command] It is used e.g. in cron configs, like this: koha-foreach --enabled /usr/share/koha/bin/cronjobs/fines.pl It would be very useful if we could provide a placeholder in the command, which could then be replaced with the name of the current instance. Then we could do e.g.: koha-foreach --enabled /usr/share/koha/bin/cronjobs/fines.pl --out /var/log/koha/__instancename__ and have fines.pl use the right directory for each instance.
Created attachment 29270 [details] [review] patch for feature update koha-foreach has been modified to replace __instancename__ with $name on each iteration using sed. The docbook file for koha-foreach has also been updated to reflect the new functionality. To test: koha-foreach ls -ld /etc/koha/sites/__instancename__ should list directories instead of giving an error message.
I haven't submitted in a while. Let me know if I've borked a step.
Created attachment 29273 [details] [review] Bug 8566: Enable koha-foreach to insert the instancename into commands koha-foreach has been modified to replace __instancename__ with $name on each iteration using sed. The docbook file for koha-foreach has also been updated to reflect the new functionality. To test: koha-foreach ls -ld /etc/koha/sites/__instancename__ should list directories instead of giving an error message. Signed-off-by: Magnus Enger <digitalutvikling@gmail.com> The suggested example with ls works as expected, as does my more complex example with fines.pl: koha-foreach --enabled /usr/share/koha/bin/cronjobs/fines.pl \ --out /var/log/koha/__instancename__/ The man page looks good too.
Created attachment 29274 [details] [review] Bug 8566: [SIGNED-OFF] Enable koha-foreach to insert the instancename into commands koha-foreach has been modified to replace __instancename__ with $name on each iteration using sed. The docbook file for koha-foreach has also been updated to reflect the new functionality. To test: koha-foreach ls -ld /etc/koha/sites/__instancename__ should list directories instead of giving an error message. Signed-off-by: Magnus Enger <digitalutvikling@gmail.com> The suggested example with ls works as expected, as does my more complex example with fines.pl: koha-foreach --enabled /usr/share/koha/bin/cronjobs/fines.pl \ --out /var/log/koha/__instancename__/ The man page looks good too.
Created attachment 29309 [details] [review] Bug 8566: [SIGNED-OFF] Enable koha-foreach to insert the instancename into commands koha-foreach has been modified to replace __instancename__ with $name on each iteration using sed. The docbook file for koha-foreach has also been updated to reflect the new functionality. To test: koha-foreach ls -ld /etc/koha/sites/__instancename__ should list directories instead of giving an error message. Signed-off-by: Magnus Enger <digitalutvikling@gmail.com> The suggested example with ls works as expected, as does my more complex example with fines.pl: koha-foreach --enabled /usr/share/koha/bin/cronjobs/fines.pl \ --out /var/log/koha/__instancename__/ The man page looks good too. Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Patch pushed to master. Thanks Reed!