From 2eb57be9dd03748885d7ddbf9d95825bcc8f9341 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 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. --- debian/scripts/koha-stop-zebra | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/debian/scripts/koha-stop-zebra b/debian/scripts/koha-stop-zebra index a584ca1..3e8660b 100755 --- a/debian/scripts/koha-stop-zebra +++ b/debian/scripts/koha-stop-zebra @@ -30,16 +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/" \ - --user="$instancename-koha.$instancename-koha" \ - --stop \ - -- \ - zebrasrv \ - 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.8.1