Skip to content

Instantly share code, notes, and snippets.

@MagnusEnger
Created October 30, 2013 08:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MagnusEnger/7229191 to your computer and use it in GitHub Desktop.
Save MagnusEnger/7229191 to your computer and use it in GitHub Desktop.
This script is based on the commands made available by a package installation of Koha. It takes the name of a syspref as its argument, then prints the value of that syspref for every Koha instance on the server.
#!/bin/bash
# Check that the user is root
if [ "$(whoami)" != "root" ]; then
echo "Sorry, you are not root."
exit 1
fi
die() {
echo "$@" 1>&2
exit 1
}
[ "$#" = 1 ] || die "Usage: $0 sysprefname"
for name in $(koha-list); do
echo -n "$name: "
# Output from this next line is two lines:
# - First line is just the string "value"
# - Second line is the actual value we are looking for
# The sed command gives us just the second line
echo "SELECT value FROM systempreferences WHERE variable = '$1'" | sudo koha-mysql $name | sed -n '2 p'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment