Bug 27115: Use start-stop-daemon to stop in koha-sip
There has been an issue where a restart of koha-sip would sometimes not bring the SIP server back alive. This is because we have not been waiting for koha-sip --stop to actually stop the SIP server(s). It is then possible for a restart to attempt the --start command while a previous instance of SIP server is still running. As the --start command in this case is not allowed, we would then end up not starting the SIP server(s) at all. This patch replaces daemon --stop with start-stop-daemon --stop to ensure koha-sip daemon actually stops. start-stop-daemon provides us the --retry option, which we are able to utilize in waiting for the stop process to finish. To test: 1. Before applying this patch 2. Run this command export SIPINSTANCE="your_koha_instance_name" You can your_koha_instance_name using the koha-list command 3. Configure a SIP server (add some min_servers, e.g. 6, to SIPConfig.xml) 4. koha-sip --enable $SIPINSTANCE 5. koha-sip --verbose --start $SIPINSTANCE 6. Observe "Starting SIP server for ..." 7. koha-sip --verbose --stop $SIPINSTANCE; ps aux | grep $SIPINSTANCE-koha-sip 8. Observe "Stopping SIP server for instancename" 9. In the output, observe the number of SIP servers you defined in step 3, plus one. 10. koha-sip --verbose --start $SIPINSTANCE 11. Apply this patch, or edit the koha-sip directly to get changes in place in your environment, e.g. using command nano $(which koha-sip) 12. koha-sip --verbose --stop $SIPINSTANCE; ps aux | grep $SIPINSTANCE-koha-sip 13. Observe "Stopping SIP server for instancename" 14. In the output, observe no more SIP servers alive Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
56d69d9f4d
commit
8673c798d5
|
|
@ -112,22 +112,14 @@ start_sip()
|
|||
stop_sip()
|
||||
{
|
||||
local name=$1
|
||||
local PIDFILE="/var/run/koha/${name}/${name}-koha-sip.pid"
|
||||
|
||||
if is_sip_running $name; then
|
||||
|
||||
DAEMONOPTS="--name=${name}-koha-sip \
|
||||
--errlog=/var/log/koha/${name}/sip-error.log \
|
||||
--output=/var/log/koha/${name}/sip-output.log \
|
||||
--verbose=1 \
|
||||
--respawn \
|
||||
--delay=30 \
|
||||
--pidfiles=/var/run/koha/${name} \
|
||||
--user=${name}-koha.${name}-koha"
|
||||
|
||||
[ "$verbose" != "no" ] && \
|
||||
log_daemon_msg "Stopping SIP server for ${name}"
|
||||
|
||||
if daemon $DAEMONOPTS --stop; then
|
||||
if start-stop-daemon --pidfile $PIDFILE --user ${name}-koha --stop --retry=TERM/30/KILL/5; then
|
||||
([ "$verbose" != "no" ] && \
|
||||
log_end_msg 0) || return 0
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue