Chapter 149. Support Scripts

Table of Contents

marc_export: Exporting Bibliographic Records into MARC files
Importing Authority Records from Command Line

Various scripts are included with Evergreen in the /openils/bin/ directory (and in the source code in Open-ILS/src/support-scripts and Open-ILS/src/extras). Some of them are used during the installation process, such as eg_db_config, while others are usually run as cron jobs for routine maintenance, such as fine_generator.pl and hold_targeter.pl. Others are useful for less frequent needs, such as the scripts for importing/exporting MARC records. You may explore these scripts and adapt them for your local needs. You are also welcome to share your improvements or ask any questions on the Evergreen IRC channel or email lists.

Here is a summary of the most commonly used scripts. The script name links to more thorough documentation, if available.

marc_export: Exporting Bibliographic Records into MARC files

The following procedure explains how to export Evergreen bibliographic records into MARC files using the marc_export support script. All steps should be performed by the opensrf user from your Evergreen server.

Note

Processing time for exporting records depends on several factors such as the number of records you are exporting. It is recommended that you divide the export ID files (records.txt) into a manageable number of records if you are exporting a large number of records.

  1. Create a text file list of the Bibliographic record IDs you would like to export from Evergreen. One way to do this is using SQL:

    SELECT DISTINCT bre.id FROM biblio.record_entry AS bre
        JOIN asset.call_number AS acn ON acn.record = bre.id
        WHERE bre.deleted='false' and owning_lib=101 \g /home/opensrf/records.txt;

    This query creates a file called records.txt containing a column of distinct IDs of items owned by the organizational unit with the id 101.

  2. Navigate to the support-scripts folder

    cd /home/opensrf/Evergreen-ILS*/Open-ILS/src/support-scripts/
  3. Run marc_export, using the ID file you created in step 1 to define which files to export. The following example exports the records into MARCXML format.

    cat /home/opensrf/records.txt | ./marc_export --store -i -c /openils/conf/opensrf_core.xml \
        -x /openils/conf/fm_IDL.xml -f XML --timeout 5 > exported_files.xml

Note

marc_export was updated in Evergreen 2.6 and now does not output progress as it executes.

Note

You can use the --since option to export records modified after a certain date and time.

Note

By default, marc_export will use the reporter storage service, which should work in most cases. But if you have a separate reporter database and you know you want to talk directly to your main production database, then you can set the --store option to cstore or storage.

Note

For more information, run marc_export with the -h option:

./marc_export -h