Utilities

Utilities are stand-alone programs shipped with the Pocket Archive installation. These include a command-line admin tool and some daemons that can be run depending on needs of the archive.

Each of these commands points to a specific archive in the system, indicated by the PKAR_ROOT and PKAR_CONFIG_DIR environment variables. Multiple archives can thus be managed on the same system.

pkar

This command-line utility performs various administrative tasks necessary to run the archive. They include:

  • deposit: deposit a local SIP.
  • dump-archive: dump the whole archive as serialized RDF.
  • dump-ll: dump the laundry list CSV for a resource or a whole submission.
  • dump-res: dump the RDF for a single resource.
  • dump-schema: dump the schema definition for a content type.
  • gen-cmdoc: generate content model documentation as a static site.
  • gen-site: generate the presentation static site.
  • get-members: Get the member IDs of a container.
  • init: initialize the archive and clear all preexisting contents.
  • list: list all resource IDs in the archive, optionally filtered by type.
  • list-ctypes: dump a plain list of content type identifiers that can be used with dump-schema or list.
  • list-subs: List all submissions with some basic details.
  • remove: Remove a resource.

The full list of command can also be viewed by entering pkar, and detailed information about each command with pkar <command> --help.

You can change logging verbosity using the PKAR_LOGGING variable. Accepted values are debug, info, warning, and err.

Log messages are output to standard error, while command results go to standard output. Both streams go to the console you type in. If the logging bothers you, append 2>/dev/null to the above commands, or make it less verbose.

All pkar commands write informative output (logging) to standard error, and actual results of the command to standard output, so that multiple commands may be piped together or written to file descriptors.

Some commands accept multiple resource identifiers for batch-processing, and those identifiers can come from the output of another command. It is possible, for example, to execute:

pkar get-members <container id> | pkar dump-ll > chain.csv

to generate a laundry list from all the members of a container, and write the output to a CSV file.

pkar_watch

Start a submission watchdog service. It is up to the administrator to create a permanent service entry to start it at boot (e.g., via systemd).

pkar_http

Start an admin interface as a web service that runs on a port defined in the http.port section of the application configuration (by default, 5000). This service also can be set up as a system service to run automatically. A proxy for secure remote access, such as Nginx, should be set up separately.