About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
administration:automation:koha

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
administration:automation:koha [2023/03/06 20:41] demiankatzadministration:automation:koha [2023/05/03 16:40] (current) – [VuFind® / Koha Automation] demiankatz
Line 1: Line 1:
 ====== VuFind® / Koha Automation====== ====== VuFind® / Koha Automation======
  
-// Thanks to Mohan Pradhan for developing this documentation. //+// Thanks to Mariyapillai Jayakananthan and Mohan Pradhan for developing this documentation. //
  
 =====Auto-incremental harvesting and indexing ===== =====Auto-incremental harvesting and indexing =====
Line 8: Line 8:
  
 Some notes: Some notes:
-  * In examples, the Koha instance name is Pasantha; yours will be different.+  * In examples, it is assumed that your oai.ini configuration includes a [Koha] section for harvesting records from Koha. You should change the OAI_KOHA_SOURCE variable if you use a different name.
   * The example script assumes that VuFind®'s environment variables are defined in /etc/profile.d/vufind.sh (the default location set up by the .deb package installation). If your setup is different, adjustments may be needed.   * The example script assumes that VuFind®'s environment variables are defined in /etc/profile.d/vufind.sh (the default location set up by the .deb package installation). If your setup is different, adjustments may be needed.
  
 ==== Script for incremental OAI-PMH harvesting and indexing with VuFind® ==== ==== Script for incremental OAI-PMH harvesting and indexing with VuFind® ====
  
-Create a script with the filename **harvest.sh**. You can put this script anywhere you like; $VUFIND_LOCAL_DIR/cron might be a good choice. We will use that for example purposes here.+Create a script with the filename **harvest.sh**. You can put this script anywhere you like; $VUFIND_LOCAL_DIR/cron might be a good choice. We will use that for example purposes on this page.
  
 <code bash> <code bash>
Line 20: Line 20:
 export PATH=/bin:/usr/bin:/usr/local/bin export PATH=/bin:/usr/bin:/usr/local/bin
 source /etc/profile.d/vufind.sh source /etc/profile.d/vufind.sh
 +
 +# Koha source defined in oai.ini; change as needed
 +OAI_KOHA_SOURCE=Koha
  
 # Harvest new records: # Harvest new records:
-php $VUFIND_HOME/harvest/harvest_oai.php KOHA_Pasantha+php $VUFIND_HOME/harvest/harvest_oai.php $OAI_KOHA_SOURCE
  
 # Process harvested Koha records: # Process harvested Koha records:
-$VUFIND_HOME/harvest/batch-import-marc.sh KOHA_Pasantha +$VUFIND_HOME/harvest/batch-import-marc.sh $OAI_KOHA_SOURCE 
-$VUFIND_HOME/harvest/batch-delete.sh KOHA_Pasantha+$VUFIND_HOME/harvest/batch-delete.sh $OAI_KOHA_SOURCE
  
 # Rebuild index # Rebuild index
Line 32: Line 35:
 </code> </code>
  
-Make sure the file is owned by an appropriate user (generally, it is best to have a specific account reserved for VuFind®-related processes). If necessary, change file ownership, e.g.: ''chown vufind:vufind harvest.sh''.+Make sure the file is owned by an appropriate user (generally, it is best to have a specific account reserved for VuFind®-related processes -- see [[administration:security#creating_a_system_account_for_vufind|creating a systema ccount for VuFind®]] for details). If necessary, change file ownership, e.g.: ''chown vufind:vufind harvest.sh''.
  
 Make the file executable by running this command: ''chmod u+x harvest.sh''. Make the file executable by running this command: ''chmod u+x harvest.sh''.
Line 51: Line 54:
  
 (This example runs the script every day at 8:15pm; see [[administration:automation#using_cron|Using Cron]] for more details on how this works). (This example runs the script every day at 8:15pm; see [[administration:automation#using_cron|Using Cron]] for more details on how this works).
 +
 +==== Incorporating additional sources ====
 +
 +It is possible that your VuFind® instance harvests records from multiple sources. In that case, you can feel free to add additional harvesting and indexing steps to the script.
 +
 +=== Koha + DSpace example ===
 +
 +For example, if you ingest DSpace records along with Koha records, you could modify the script to something like this:
 +
 +<code bash>
 +#!/bin/bash
 +# Set up necessary environment variables
 +export PATH=/bin:/usr/bin:/usr/local/bin
 +source /etc/profile.d/vufind.sh
 +
 +# The names of the harvest sections in oai.ini; change as needed:
 +OAI_DSPACE_SOURCE=DSpace
 +OAI_KOHA_SOURCE=Koha
 +
 +# Harvest new records (do not specify a harvest source in order to harvest all sources):
 +php $VUFIND_HOME/harvest/harvest_oai.php
 +
 +# Process harvested DSpace records:
 +$VUFIND_HOME/harvest/batch-import-xsl.sh $OAI_DSPACE_SOURCE dspace.properties
 +$VUFIND_HOME/harvest/batch-delete.sh $OAI_DSPACE_SOURCE
 +
 +# Process harvested Koha records:
 +$VUFIND_HOME/harvest/batch-import-marc.sh $OAI_KOHA_SOURCE
 +$VUFIND_HOME/harvest/batch-delete.sh $OAI_KOHA_SOURCE
 +
 +# Rebuild index
 +$VUFIND_HOME/index-alphabetic-browse.sh
 +</code>
 +
 +=== Multiple Koha instances example ===
 +
 +As another example, if you harvest from multiple Koha instances using [[indexing:marc:multiple_configs|different configuration files for each instance]], your script might look like this:
 +
 +<code bash>
 +#!/bin/bash
 +# Set up necessary environment variables
 +export PATH=/bin:/usr/bin:/usr/local/bin
 +source /etc/profile.d/vufind.sh
 +
 +# Harvest new records (do not specify a harvest source in order to harvest all sources):
 +php $VUFIND_HOME/harvest/harvest_oai.php
 +
 +# Process harvested Koha records from two sources -- this example uses the names "Pasantha"
 +# and "Kohulan" but of course these should be changed to your local instance names in practice.
 +# You could repeat the import/delete lines for any number of sources, as long as each pair uses
 +# an appropriate configuration file and directory name. Note that if you applying a different
 +# ID prefix to each source, additional work may be needed to pre-process deleted record IDs so
 +# that batch-delete.sh works as expected.
 +$VUFIND_HOME/harvest/batch-import-marc.sh -p /usr/local/vufind/local/import/import-Pasantha.properties Koha_Pasantha
 +$VUFIND_HOME/harvest/batch-delete.sh Koha_Pasantha
 +$VUFIND_HOME/harvest/batch-import-marc.sh -p /usr/local/vufind/local/import/import-Kohulan.properties Koha_Kohulan
 +$VUFIND_HOME/harvest/batch-delete.sh Koha_Kohulan
 +
 +# Rebuild index
 +$VUFIND_HOME/index-alphabetic-browse.sh
 +</code>
  
 ---- struct data ---- ---- struct data ----
administration/automation/koha.1678135311.txt.gz · Last modified: 2023/03/06 20:41 by demiankatz