diff --git a/debian/docs/koha-mysqlcheck.xml b/debian/docs/koha-mysqlcheck.xml new file mode 100644 index 0000000000..88b01d715c --- /dev/null +++ b/debian/docs/koha-mysqlcheck.xml @@ -0,0 +1,44 @@ +
+koha-mysqlcheck + +Koha is the first free software library automation package. + + The Koha Community + http://koha-community.org/ + + + + + + + koha-mysqlcheck + 8 + + + + koha-mysqlcheck + Run mysqlcheck on the database of the specified Koha instance. + UNIX/Linux + + + + + koha-mysqlcheck instancename + + + + Description + Run mysqlcheck on the database of the specified Koha instance. + Any arguments provided before the name of the instance are passed directly to mysqlcheck. This means that all the operations of mysqlcheck are available through this script. + + + See also + + mysqlcheck(1) + koha-mysql(8) + + + + + +
diff --git a/debian/scripts/koha-mysqlcheck b/debian/scripts/koha-mysqlcheck new file mode 100755 index 0000000000..5a5286b481 --- /dev/null +++ b/debian/scripts/koha-mysqlcheck @@ -0,0 +1,48 @@ +#!/bin/bash +# +# koha-mysqlcheck: run mysqlcheck on the database of the specified Koha instance. +# Copyright 2013 Magnus Enger Librioech +# Based on koha-mysql, which is Copyright 2011 Catalyst IT, Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -e + +umask 0077 + +die() { + echo "$@" 1>&2 + exit 1 +} + +# Parse command line. +if [ $# -lt 1 ]; then + die "Usage: $0 [options] instancename" +fi + +# Separate any arguments from the instance name +array=($@) +len=${#array[@]} +name=${array[$len-1]} +args=${array[@]:0:$len-1} + +kohaconfig="/etc/koha/sites/$name/koha-conf.xml" + +mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )" +mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )" +mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )" +mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )" + +mysqlcheck --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpass" \ + $args "$mysqldb"