From 3932480d6f8529481452c03de9f0456e113834ed Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 2 Aug 2016 23:26:03 -0400 Subject: [PATCH] Bug 16885: koha-stop-zebra should be more sure of stopping zebrasrv MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch follows Galen's suggestion in comment #7. TEST PLAN --------- 1) Back up your koha logs as desired. 2) add something to /var/log/koha/{instance name}/intranet-error.log 3) ps aux | grep zebra 4) logrotate -f /etc/logrotate.d/koha-common 5) ps aux | grep zebra -- the zebrasrv and daemon process for zebra indexing didn't restart. 6) apply this patch against /usr/sbin/koha-stop-zebra 7) sudo koha-start-zebra {instance name} 8) ps aux | grep zebra -- the processes should have started up again. 9) add different junk to /var/log/koha/{instance name}/intranet-error.log 10) ps aux | grep zebra 11) logrotate -f /etc/logrotate.d/koha-common 12) ps aux | grep zebra -- the process ids for the zebrasrv and daemon processes should be different, but the number of processes is the same as before. 13) sign off, because its less ugly than comment #3 Sponsored-by: Tulong Aklatan Signed-off-by: Tomas Cohen Arazi Works as expected, no regressions found. Signed-off-by: Kyle M Hall (cherry picked from commit ac4a058b05fc1a1a6955d025328cca6ae369baeb) Signed-off-by: Frédéric Demians (cherry picked from commit 16769bdb1445bcccd3be0221ba69917344f363e9) Signed-off-by: Julian Maurice --- debian/scripts/koha-stop-zebra | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/debian/scripts/koha-stop-zebra b/debian/scripts/koha-stop-zebra index e6aae7d10d..3e8660b0c1 100755 --- a/debian/scripts/koha-stop-zebra +++ b/debian/scripts/koha-stop-zebra @@ -30,24 +30,15 @@ stop_zebra_instance() { local instancename=$1 + local PIDFILE="/var/run/koha/${instancename}/${instancename}-koha-zebra.pid" echo "Stopping 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" \ - --stop \ - -- \ - zebrasrv \ - -v none,fatal,warn \ - -f "/etc/koha/sites/$instancename/koha-conf.xml" && \ - return 0 || \ - return 1 + + if start-stop-daemon --pidfile ${PIDFILE} --stop --quiet --retry=TERM/30/KILL/5; then + return 0; + else + return 1; + fi + } usage() -- 2.39.5