Bug 17468: Remove koha-*-zebra scripts and its traces

This patch removes traces from the (deprecated) koha-*-zebra scripts.

To test:
- Apply the patch
- Verify no traces of koha-*-zebra remain on the codebase (besides
  Release Notes and the koha-zebra script):
  $ cd kohaclone
  $ git grep koha-start-zebra
  $ git grep koha-stop-zebra
  $ git grep koha-restart-zebra
=> SUCCESS: No traces!
- Create the following symlinks:
  $ sudo ln -s /usr/sbin/koha-zebra  /usr/sbin/koha-start-zebra
  $ sudo ln -s /usr/sbin/koha-zebra  /usr/sbin/koha-stop-zebra
  $ sudo ln -s /usr/sbin/koha-zebra  /usr/sbin/koha-restart-zebra
- Try the koha-*-zebra commands:
  $ sudo koha-stop-zebra kohadev
  $ sudo koha-start-zebra kohadev
  $ sudo koha-restart-zebra kohadev
=> SUCCESS: They all work as expected!

- Sign off :-D!

Sponsored-by: Orex Digital

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomas Cohen Arazi 2018-02-17 12:20:09 -03:00 committed by Jonathan Druart
parent 5e93b777fd
commit 385c16174b
11 changed files with 6 additions and 438 deletions

View File

@ -119,16 +119,9 @@
<variablelist>
<varlistentry>
<term><option>koha-start-zebra</option></term>
<term><option>koha-zebra</option></term>
<listitem>
<para>Start Zebra for named Koha instances.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>koha-restart-zebra</option></term>
<listitem>
<para>Restart Zebra for named Koha instances.</para>
<para>Manage the Zebra daemon for named Koha instances.</para>
</listitem>
</varlistentry>
@ -139,13 +132,6 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>koha-stop-zebra</option></term>
<listitem>
<para>Stop Zebra for named Koha instances.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>koha-indexer</option></term>
<listitem>

View File

@ -86,9 +86,7 @@
<refsect1><title>See also</title>
<simplelist type="inline">
<member><command>koha-restart-zebra(8)</command></member>
<member><command>koha-start-zebra(8)</command></member>
<member><command>koha-stop-zebra(8)</command></member>
<member><command>koha-zebra(8)</command></member>
</simplelist>
</refsect1>

View File

@ -1,44 +0,0 @@
<article xmlns='http://docbook.org/ns/docbook'>
<title>koha-restart-zebra</title>
<info>
<productname>Koha</productname> is the first free software library automation package.
<author>
<orgname>The Koha Community</orgname>
<uri>http://koha-community.org/</uri>
</author>
</info>
<refentry xml:id="koha-restart-zebra">
<refmeta>
<refentrytitle>koha-restart-zebra</refentrytitle>
<manvolnum>8</manvolnum>
</refmeta>
<refnamediv>
<refname>koha-restart-zebra</refname>
<refpurpose>Restart Zebra for named Koha instances.</refpurpose>
<refclass>UNIX/Linux</refclass>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>koha-restart-zebra</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>Restart Zebra for named Koha instances.</para>
</refsect1>
<refsect1><title>See also</title>
<simplelist type="inline">
<member><command>koha-rebuild-zebra(8)</command></member>
<member><command>koha-start-zebra(8)</command></member>
<member><command>koha-stop-zebra(8)</command></member>
</simplelist>
</refsect1>
</refentry>
</article>

View File

@ -1,44 +0,0 @@
<article xmlns='http://docbook.org/ns/docbook'>
<title>koha-start-zebra</title>
<info>
<productname>Koha</productname> is the first free software library automation package.
<author>
<orgname>The Koha Community</orgname>
<uri>http://koha-community.org/</uri>
</author>
</info>
<refentry xml:id="koha-start-zebra">
<refmeta>
<refentrytitle>koha-start-zebra</refentrytitle>
<manvolnum>8</manvolnum>
</refmeta>
<refnamediv>
<refname>koha-start-zebra</refname>
<refpurpose>Start Zebra for named Koha instances.</refpurpose>
<refclass>UNIX/Linux</refclass>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>koha-start-zebra</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>Start Zebra for named Koha instances.</para>
</refsect1>
<refsect1><title>See also</title>
<simplelist type="inline">
<member><command>koha-rebuild-zebra(8)</command></member>
<member><command>koha-restart-zebra(8)</command></member>
<member><command>koha-stop-zebra(8)</command></member>
</simplelist>
</refsect1>
</refentry>
</article>

View File

@ -1,44 +0,0 @@
<article xmlns='http://docbook.org/ns/docbook'>
<title>koha-stop-zebra</title>
<info>
<productname>Koha</productname> is the first free software library automation package.
<author>
<orgname>The Koha Community</orgname>
<uri>http://koha-community.org/</uri>
</author>
</info>
<refentry xml:id="koha-stop-zebra">
<refmeta>
<refentrytitle>koha-stop-zebra</refentrytitle>
<manvolnum>8</manvolnum>
</refmeta>
<refnamediv>
<refname>koha-stop-zebra</refname>
<refpurpose>Stop Zebra for named Koha instances.</refpurpose>
<refclass>UNIX/Linux</refclass>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>koha-stop-zebra</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>Stop Zebra for named Koha instances.</para>
</refsect1>
<refsect1><title>See also</title>
<simplelist type="inline">
<member><command>koha-rebuild-zebra(8)</command></member>
<member><command>koha-restart-zebra(8)</command></member>
<member><command>koha-start-zebra(8)</command></member>
</simplelist>
</refsect1>
</refentry>
</article>

View File

@ -130,11 +130,6 @@ complete -F _koha_disabled_instances koha-enable
# koha-disable autocompletes with enabled instances
complete -F _koha_enabled_instances koha-disable
# koha-*-zebra autocomplete with enabled instances
complete -F _koha_enabled_instances koha-start-zebra
complete -F _koha_enabled_instances koha-restart-zebra
complete -F _koha_enabled_instances koha-stop-zebra
# koha-mysql autocompletes with a single instance name
complete -F _koha_single_instance koha-mysql

View File

@ -26,13 +26,10 @@ debian/scripts/koha-plack usr/sbin
debian/scripts/koha-rebuild-zebra usr/sbin
debian/scripts/koha-remove usr/sbin
debian/scripts/koha-reset-passwd usr/sbin
debian/scripts/koha-restart-zebra usr/sbin
debian/scripts/koha-restore usr/sbin
debian/scripts/koha-run-backups usr/sbin
debian/scripts/koha-shell usr/sbin
debian/scripts/koha-sitemap usr/sbin
debian/scripts/koha-start-zebra usr/sbin
debian/scripts/koha-stop-zebra usr/sbin
debian/scripts/koha-translate usr/sbin
debian/scripts/koha-upgrade-schema usr/sbin
debian/scripts/koha-upgrade-to-3.4 usr/sbin

3
debian/koha-common.links vendored Normal file
View File

@ -0,0 +1,3 @@
usr/sbin/koha-zebra usr/sbin/koha-start-zebra
usr/sbin/koha-zebra usr/sbin/koha-stop-zebra
usr/sbin/koha-zebra usr/sbin/koha-restart-zebra

View File

@ -1,116 +0,0 @@
#!/bin/sh
#
# koha-restart-zebra - Restart Zebra for named Koha instances
# Copyright 2010 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 <http://www.gnu.org/licenses/>.
set -e
# include helper functions
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
. "/usr/share/koha/bin/koha-functions.sh"
else
echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
exit 1
fi
restart_zebra_instance()
{
local instancename=$1
if is_zebra_running $instancename; then
echo "Restarting Zebra server for $instancename"
daemon \
--name="$instancename-koha-zebra" \
--pidfiles="/var/run/koha/$instancename/" \
--errlog="/var/log/koha/$instancename/zebra-error.log" \
--stdout="/var/log/koha/$instancename/zebra.log" \
--output="/var/log/koha/$instancename/zebra-output.log" \
--verbose=1 \
--respawn \
--delay=30 \
--user="$instancename-koha.$instancename-koha" \
--restart \
-- \
zebrasrv \
-v none,fatal,warn \
-f "/etc/koha/sites/$instancename/koha-conf.xml" && \
return 0
else
return 1
fi
}
start_zebra_instance()
{
local instancename=$1
if is_enabled $instancename; then
echo "Starting Zebra server for $instancename"
daemon \
--name="$instancename-koha-zebra" \
--pidfiles="/var/run/koha/$instancename/" \
--errlog="/var/log/koha/$instancename/zebra-error.log" \
--stdout="/var/log/koha/$instancename/zebra.log" \
--output="/var/log/koha/$instancename/zebra-output.log" \
--verbose=1 \
--respawn \
--delay=30 \
--user="$instancename-koha.$instancename-koha" \
-- \
zebrasrv \
-v none,fatal,warn \
-f "/etc/koha/sites/$instancename/koha-conf.xml" && \
return 0
else
return 1
fi
}
usage()
{
local scriptname=$0
cat <<EOF
Restart Zebra for Koha instances.
Usage: $scriptname instancename1 instancename2...
EOF
}
# Parse command line.
#[ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
# Loop through the instance names
for name in "$@"
do
if is_instance $name ; then
if ! is_zebra_running $name; then
warn "Zebra does not appear to have been running for instance $name."
if ! start_zebra_instance $name ; then
warn "Something went wrong starting Zebra for $name."
fi
else
if ! restart_zebra_instance $name; then
warn "Something went wrong restarting Zebra for $name."
fi
fi
else
warn "Unknown instance $name."
fi
done
exit 0

View File

@ -1,89 +0,0 @@
#!/bin/sh
#
# koha-start-zebra - Start Zebra for named Koha instances
# Copyright 2010 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 <http://www.gnu.org/licenses/>.
set -e
# include helper functions
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
. "/usr/share/koha/bin/koha-functions.sh"
else
echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
exit 1
fi
start_zebra_instance()
{
local instancename=$1
# get zebra log levels from koha-conf.xml
local loglevels=$(get_loglevels $instancename)
echo "Starting Zebra server for $instancename"
touch "/var/log/koha/$instancename/zebra-error.log" \
"/var/log/koha/$instancename/zebra-output.log"
chown "$instancename-koha:$instancename-koha" \
"/var/log/koha/$instancename/zebra-error.log" \
"/var/log/koha/$instancename/zebra-output.log"
daemon \
--name="$instancename-koha-zebra" \
--pidfiles="/var/run/koha/$instancename/" \
--errlog="/var/log/koha/$instancename/zebra-error.log" \
--output="/var/log/koha/$instancename/zebra-output.log" \
--verbose=1 \
--respawn \
--delay=30 \
--user="$instancename-koha.$instancename-koha" \
-- \
zebrasrv \
-v $loglevels \
-f "/etc/koha/sites/$instancename/koha-conf.xml" && \
return 0 || \
return 1
}
usage()
{
local scriptname=$0
cat <<EOF
Starts Zebra for Koha instances.
Usage: $scriptname instancename1 instancename2...
EOF
}
# Parse command line.
#[ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
# Loop through the instance names
for name in "$@"
do
if is_instance $name ; then
if ! is_zebra_running $name; then
if ! start_zebra_instance $name; then
warn "Something went wrong starting Zebra for $name."
fi
else
warn "Zebra already running for instance $name."
fi
else
warn "Unknown instance $name."
fi
done
exit 0

View File

@ -1,74 +0,0 @@
#!/bin/sh
#
# koha-stop-zebra - Stop Zebra for named Koha instances
# Copyright 2010 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 <http://www.gnu.org/licenses/>.
set -e
# include helper functions
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
. "/usr/share/koha/bin/koha-functions.sh"
else
echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
exit 1
fi
stop_zebra_instance()
{
local instancename=$1
local PIDFILE="/var/run/koha/${instancename}/${instancename}-koha-zebra.pid"
echo "Stopping Zebra server for $instancename"
if start-stop-daemon --pidfile ${PIDFILE} --stop --quiet --retry=TERM/30/KILL/5; then
return 0;
else
return 1;
fi
}
usage()
{
local scriptname=$0
cat <<EOF
Stops Zebra for Koha instances.
Usage: $scriptname instancename1 instancename2...
EOF
}
# Parse command line.
#[ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
# Loop through the instance names
for name in "$@"
do
if is_instance $name ; then
if is_zebra_running $name; then
if ! stop_zebra_instance $name; then
warn "Something went wrong stopping Zebra for $name."
fi
else
warn "Zebra already stopped for instance $name."
fi
else
warn "Unknown instance $name."
fi
done
exit 0