Skip to content
Patrick Hochstenbach edited this page Jan 10, 2019 · 40 revisions

There are two command line toolset for LibreCat:

  • LibreCat own command line tools
  • Catmandu

Catmandu

You can find more information about Catmandu's commands in the following places:

All Catmandu commands are available as LibreCat commands. E.g.

catmandu convert YAML to JSON < data.yml

Is the same as

bin/librecat convert YAML to JSON < data.yml

It is adviced to use the librecat version of all commands. LibreCat Configuration and Layers are automatically available using the librecat version of all Catmandu commands.

LibreCat

The librecat command is available in ${LIBRECATHOME}/bin/librecat file. You can add this file to your path, or specify a path such as bin/librecat ....

$ cd ${LIBRECATHOME}
$ bin/librecat
$ bin/librecat help

audit: manage audit messages

See Audit for more information on activation of audit messages

Lists all audit records. Optional provide a record id

bin/librecat audit list [<record-id>]

config: view the librecat configuration

View the complete merge librecat configuration files as a JSON output:

bin/librecat config

View only the default_facets setting:

bin/librecat config --fix 'retain(default_facets)'

department: manage librecat departments

Lists all department records. Optional provide a CQL query

bin/librecat department list [<cql-query>]

Export all department records as YAML. Optional provide a CQL query

bin/librecat department export [<cql-query>]

Add new department record(s) from a YAML file. This command apply validation as well (while similar Catmandu command export does not).

bin/librecat department add <FILE>

Retrieves a department record by its identifier.

bin/librecat department  get <id>

Deletes a department record by its identifier.

bin/librecat department delete <id>

Validate the content of a import YAML file, and report any errors.

bin/librecat department valid <FILE>

file_store: manage librecat file stores

A file store is the place where uploaded files are places. Each record can have a container for one of more files.

Lists containers.

bin/librecat file_store list [recursive]

Retrieves a containers or a in a container file by its identifier.

bin/librecat file_store get <key> [<file>]

Adds a new file to a container specified by the container id and path to the file.

bin/librecat file_store add <key> <file>

Deletes a file from a container.

bin/librecat file_store delete <key> <file>

Purges the container.

bin/librecat file_store purge <key>

Exports container to a zip file.

bin/librecat file_store export <key> <zip>

Imports a container from a zipped file.

bin/librecat file_store import <key> <zip>

Stores a thumbnail for a file

bin/librecat file_store thumbnail <key> <file>

Options:

  • -?, -h, --help print a usage screen
  • --store STR specify store name
  • --file_store STR store class
  • --file_opt KEY=STR... store options
  • --tmp_dir STR specify a temporary directory
  • --zip STR zipper
  • --unzip STR unzipper

generate: create HTML forms

Generate forms is the command to build all the HTML forms from field templates. Using all definitions in the configuration file config/forms.yml the templates in:

  • views/backend/generator
  • views/admin/generator

will be transformed into templates in:

  • views/backend/forms
  • views/admin/forms

When there are changes in the config/forms.yml or the generator templates, then the bin/generate_forms.pl command needs to be executed to regenerate all forms:

$ bin/librecat generate forms
[/opt/librecat-ugent/views/backend/forms]
Generating /opt/librecat-ugent/views/backend/forms/dissertation.tt
Generating /opt/librecat-ugent/views/backend/forms/expert/dissertation.tt
.
{snip}
.
Generating /opt/librecat-ugent/views/backend/forms/expert/journal_article.tt
Generating /opt/librecat-ugent/views/backend/forms/book_chapter.tt
Generating /opt/librecat-ugent/views/backend/forms/expert/book_chapter.tt
[/opt/librecat-ugent/views/admin/forms]
Generating /opt/librecat-ugent/views/admin/forms/edit_project page
Generating /opt/librecat-ugent/views/admin/forms/edit_department page
Generating /opt/librecat-ugent/views/admin/forms/edit_research_group page
Generating /opt/librecat-ugent/views/admin/forms/edit_account page
Generating /opt/librecat-ugent/views/admin/forms/edit_award page

id: view and set the LibreCat publication identifier generator

Show the identifier for the next added publication

bin/librecat id get

Set the identifier for the next added publication

bin/librecat id set <...>

index: manage the indexation of records in Elastic Search

(Re)initialize the Elastic Search indexes:

bin/librecat index initialize

Reindex the 'publication' database:

bin/librecat index create publication

Drop the 'publication' index:

bin/librecat index drop publication

Drop all the LibreCat indexes in Elastic Search:

bin/librecat index purge

Show which LibreCat indexes are available:

bin/librecat index status

Reindex all LibreCat databases:

bin/librecat index switch

project: manage librecat projects

Lists all project records. Optional provide a CQL query

bin/librecat project list [<cql-query>]

Adds new project record(s) from a YAML file. This command apply validation as well (while similar Catmandu command export does not).

bin/librecat project add <FILE>

Retrieves a project record by its identifier.

bin/librecat project get <id>

Deletes a project record by its identifier.

bin/librecat project delete <id>

Validate the content of a import YAML file, and report any errors.

bin/librecat project valid <FILE>

publication: manage librecat publications

Lists all publication records. Optional provide a CQL query

bin/librecat publication list [<cql-query>]

Export all publication records as YAML. Optional provide a CQL query

bin/librecat publication export [<cql-query>]

Retrieves a publication record in YAML format by its identifier.

bin/librecat publication get <id>

Retrieves a historical publication record in YAML format by its identifier and version number

bin/librecat publication get --version <version> <id>

Retrieves a the previous version of publication record in YAML format by its identifier

bin/librecat publication get --previous-version <id>

Retrieves all versions of publication record in YAML format by its identifier

bin/librecat publication get --history <id>

Adds new publication record(s) from a YAML file. This command apply validation as well (while similar Catmandu command export does not).

bin/librecat publication add <FILE>

Deletes a publication record by its identifier.

bin/librecat publication delete <id>

Validate the content of a import YAML file, and report any errors.

bin/librecat publication valid <FILE>

List all files for a record or CQL query.

bin/librecat publication files <id> | <cql-query>

Update the file metadata by providing a YAML with changes.

bin/librecat publication files <FILE>

List all files that have an expired embargo date.

bin/librecat publication embargo

Create a YAML file with file changes that will update the embargo date for expired files.

bin/librecat publication embargo update > embargo_update.yml

This file needs to be uploaded using the librecat publication files command.

bin/librecat publication files embargo_update.yml

reqcopy : view the request a copy database

Show listing of all active request a copy requests

bin/librecat reqcopy list

Show the details of one request a copy request

bin/librecat reqcopy get <id>

Expire all old request a copy requests

bin/librecat reqcopy expire

Delete manually one request a copy request

bin/librecat reqcopy delete <id>

queue: view the job queue status

Show the job queue status

bin/librecat queue status

Start all background workers

bin/librecat queue start

Stop all background workers

bin/librecat queue stop

sitemap: generate HTML sitemaps for a publications

Create a sitemap in the /var/www/html directory:

bin/librecat sitemap -v /var/www/html

user: manage librecat users

Lists user records. Optional provide a CQL query

bin/librecat user list [<cql-query>]

Export user records as YAML. Optional provide a CQL query

bin/librecat user export [<cql-query>]

Adds new user record(s) from a YAML file.

bin/librecat user add <FILE>

Retrieves a user record.

bin/librecat user get <id>

Deletes a user record from LibreCat storage.

bin/librecat user delete <id>

Validate the content of a import YAML file, and report any errors.

bin/librecat user valid <FILE>

url : a url tester

Given an TSV input file with ID and URL pairs, this command will follow all the URLs and report the HTTP status.

test.tsv:
1    http://www.google.com
2    http://www.micrsoft.com/blablablablabla

bin/librecat url check test.tsv
1 http://www.google.com 200
2 http://www.micrsoft.com/blablablablabla 404

worker: manage librecat worker processes

Starts worker(s).

bin/librecat worker <worker> start

Stops worker(s).

bin/librecat worker <worker> stop

Restart worker(s).

bin/librecat worker <worker> restart

Retrieves the status of worker(s).

librecat worker <worker> status

Examples:

bin/librecat worker mailer start --workers 2 --supervise
bin/librecat worker mailer stop --workers 2 --supervise

Options:

  • -? -h --help print this usage screen
  • --pid-dir STR
  • --workers INT sets the number of workers
  • --supervise
Clone this wiki locally