Koha Test Wiki Canasta - March 2024

One of a series of test instances for migrating the Koha Wiki MediaWiki database.

For the current Koha Wiki, visit https://wiki.koha-community.org .

Commands provided by the Debian packages

From Koha Test Wiki Canasta
Jump to navigation Jump to search

This page contains helpful information that is mostly pulled from the scripts themselves. If you're a novice, this might not be as helpful as a step by step, since it's assumed that you know a few things. You might be looking for this page instead. :)

Run "man koha-common" or "man <some command>" on the command line for more (and more up-to-date) information about each command. Inline help, if available, can be accessed by running any command with a --help.

Administer instances

koha-create

Create a new Koha instance.

koha-create {--create-db|--request-db|--populate-db|--use-db}
            [--marcflavor marc21|normarc|unimarc]
            [--zebralang en|es|fr|gr|nb|ru|uk] [--auth-idx dom|grs1]
            [--biblio-idx dom|grs1] [--memcached-servers server:port]
            [--memcached-prefix namespace_prefix]
            [--defaultsql /path/to/some.sql] [--configfile /path/to/config]
            [--passwdfile /path/to/passwd] [--dbhost host]
            [--database database] [--adminuser n] [--enable-sru]
            [--sru-port port] [--template-cache-dir directory]
            [--timezone time/zone] [--upload-path directory] [--letsencrypt]
            [--help|-h] {instancename}

Simple example, with MySQL running on the same server as everything else:

sudo koha-create --create-db instancename

Order of precedence for config options, from lowest to highest:

  1. The defaults set in koha-create itself
  2. /etc/koha/koha-sites.conf
  3. Config file specified with --configfile
  4. Individual options set with --marcflavor, --zebralang, --defaultsql, --adminuser

See Koha on Debian for further details.

koha-disable

Disable a Koha instance.

koha-disable instancename

koha-enable

Enable a Koha instance. New instances are enabled by default. You only need this command if you have previously disabled a site with koha-disable.

koha-enable instancename

koha-restore

Restore a Koha site from a dump (from koha-dump).

koha-restore sqldump configdump

Before restoring an instance you should koha-remove it first.

koha-dump

Create a dump of an instance's data for backup and migration. It does not include uploaded and temporary uploaded files unless specified.

koha-dump instancename

Options:

--schema-only         Dump only the database schema
--exclude-indexes     Include Zebra indexes on the backup
--uploaded_files      Include uploaded files.
--uploaded_temp_files Include temporary uploaded files.
--quiet|-q            Make the script avoid printing to STDOUT
                      (useful for calling from another scripts)
--help|-h             Display this help message
--without-db-name     Do not include database name

NOTE: Backups created using this command can be restored using koha-restore.

koha-run-backups

Performs backups of the koha installations on the system

This allows automation of backing up the koha data and configuration to the filesystem. It will keep the past so many backups, discarding older ones.

Options:

--output /path     The directory that the resulting files will be placed into.
                   (default: /var/spool/koha)
--days 2           The number of days to keep backups around for
                   (default: 2)
--exclude-indexes  Exclude Zebra indexes from the backups (default: false)

Note: backups produced using this tool can be restored using koha-restore.

koha-remove

Remove a Koha instance.

koha-remove instance1 instance2 etc

Zebra

koha-zebra

Handle Zebra for named Koha instances.

Usage:

koha-zebra [--start|--stop|--restart] [--status] [--quiet|-q] [-h|--help]

    --start        Start Zebra for named Koha instances.
    --stop         Stop Zebra for named Koha instances.
    --restart      Restart Zebra for named Koha instances.
    --status       Show status information about Zebra daemon for named Koha instances.
    --verbose|-v   Display progress messages.
    --help|-h      Show this information.

koha-rebuild-zebra

Rebuild the Zebra database for a Koha instance.

koha-rebuild-zebra [-u|--usmarc] [-f|--full] [-...] instance1 instance2 etc
  • -u: runs the process as USMARC rather than the default of MARCXML
  • -f: does a reindex of the whole collection
  • -...: anything else is passed directly to rebuild_zebra. This is useful in particular for -v.

As an example, a full, verbose reindex for one instance would look like this:

sudo koha-rebuild-zebra -f -v  instancename

To do a verbose reindex of only authorities, you could do this:

sudo koha-rebuild-zebra -f -v -a instancename

koha-indexer

Manage the indexer daemon for name Koha instances

koha-indexer [--start|--stop|--restart] [--quiet|-q] instancename1 instancename2...]

    --start      Start the indexer daemon for the specified instances
    --stop       Stop the indexer daemon for the specified instances
    --restart    Restart the indexer daemon for the specified instances
    --quiet|-q   Make the script quiet about non existent instance names
                 (useful for calling from another scripts)
    --help|-h    Show usage information

[DEPRECATED] koha-start-zebra, koha-stop-zebra and koha-restart-zebra

This legacy scripts individually implemented each of the actions now handled by koha-zebra through option switches.

Elasticsearch

koha-elasticsearch

Rebuild Elasticsearch indexes

koha-elasticsearch --rebuild [-b|--biblios] [-a|--authorities] [-v|--verbose]
                             [-c n|--commit n] [-v|--verbose] {instancename...}

Plack

koha-plack

Manage running Plack daemons for named Koha instances

This script lets you manage the plack daemons for your Koha instances.

koha-plack --start|--stop|--restart [--quiet|-q] instancename1 [instancename2...]
koha-plack --enable|--disable instancename1 [instancename2]
 
    --start      Start the plack daemon for the specified instances
    --stop       Stop the plack daemon for the specified instances
    --restart    Restart the plack daemon for the specified instances
    --enable     Enable plack for the specified instances
    --disable    Disable plack for the specified instances
    --quiet|-q   Make the script quiet about non existent instance names
                 (useful for calling from another scripts)
    --help|-h    Display this help message

Email

koha-email-enable

Turn on email for a Koha instance. Also enables SMS if configured.

koha-email-enable instance1 instance2 etc

koha-email-disable

Turn off email for a Koha instance. Also disables SMS if configured.

koha-email-disable instance1 instance2 etc

SIP2

koha-sip

Manage the SIP server for Koha instances.

koha-sip [--start|--stop|--restart] instancename1 [instancename2...]

    --start     Start the SIP server for the specified instance(s)
    --stop      Stop the SIP server for the specified instance(s)
    --restart   Restart the SIP server for the specified instance(s)
    --status    Show the status of the SIP server for the specified instance(s)
    --verbose   Display progress and actions messages
    --help|-h   Display this help message

[DEPRECATED] koha-enable-sip, koha-start-sip and koha-stop-sip

These legacy scripts individually implemented each of the actions now handled by koha-sip through option switches.

Database

koha-dump-defaults

Create default contents from an existing Koha site.

koha-dump-defaults instancename

koha-upgrade-schema

Upgrade the DB schema for Koha instances. Done automatically on package upgrades.

koha-upgrade-schema instance1 instance2 etc

koha-reset-passwd

Reset password for a user in a Koha instance.

koha-reset-passwd instancename username

koha-mysql

Provide an interactive mysql shell set up for the specified Koha instance.

koha-mysql instancename

To send some SQL to MySQL and get an answer back, without going into an interactive session (similar to the -e option to the mysql command):

echo "some sql" | koha-mysql instancename

This command was added in Koha 3.6.

Translation

koha-translate

Manage the languages available for your Koha installation.

koha-translate [--list|--available] [--install] ... language-code

    --list|-l        List the installed or available (combined with -a)
                     language translations
    --available|-a   Used in conjunction with -l to show all languages
    --check|-c       Check if all the .PO files are present for the specified language.
    --install|-i     Install the specified language translations
    --update|-u      Update the specified language translations
    --remove|-r      Remove the specified language translations
    --verbose|-v     Be more verbose on the translation process
    --help|-h        Display this help message
    --dev|-d         Limit actions to a specific dev instance

Example to install a language:

koha-translate -i <language-code>

For more information see installation of additional languages.

Bots

koha-sitemap

This script lets you manage sitemaps for your Koha instances (to avoid annoying bots eating up your CPU).

koha-sitemap [--enable|--disable] [--generate] [instancename1] [instancename2] [...]

    --enable     Enable sitemap generation for the specified instances
    --disable    Disable sitemap generation for the specified instances
    --generate   (Re)generate sitemap for the specified instances
    --quiet|-q   Make the script quiet about non existent instance names 
                 (useful for calling from another scripts).
    --help|-h    Display this help message

Miscellaneous

koha-upgrade-to-3.4

Performs the necessary changes to upgrade a Koha system from 3.2 to 3.4.

koha-upgrade-to-3.4 [instance1] [instance2] [...]

If no instance names are provided, this will run it on all of them.

koha-shell

Opens a shell with the user, environment and Perl library paths set up for a particular instance. This is useful if you need to run Koha tools directly.

koha-shell [-c COMMAND] [-h] [-l] [-m|-p|--preserve-environment] [-s SHELL] [-v|--verbose] [instancename]

Utilities

These are scripts used by other scripts, you probably do not want to run them from the command line.

koha-create-dirs

Create directories for a Koha instance.

koha-create-dirs [instance1] [instance2] [...]

koha-list

Lists Koha instances, optionally only those that are enabled, or have email, SIP, plack or letsencrypt turned on.

koha-list [--enabled|--disabled] [--email|--noemail] [--sip|--nosip] [-h]

    --enabled         Show enabled instances
    --disabled        Show disabled instances
    --email           Show instances with email enabled
    --noemail         Show instances with email disabled
    --sip             Show instances with SIP enabled
    --nosip           Show instances with SIP disabled
    --plack           Show instances with Plack enabled
    --noplack         Show instances with Plack disabled
    --letsencrypt     Show instances with letsencrypt enabled
    --noletsencrypt   Show instances with letsencrypt disabled
    --help | -h       Show this help

The filtering options can be combined, and you probably want to do this (except --email and --noemail, or --enabled and --disabled, that's just silly).

koha-foreach

Run a command for each Koha instance.

Takes the same arguments as koha-list.

koha-foreach [--enabled] [--email | --noemail] command

See also


Developer handbook