[Koha-bugs] [Bug 23700] Fix output of koha-plack --restart

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Sep 30 15:00:44 CEST 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23700

--- Comment #1 from Magnus Enger <magnus at libriotech.no> ---
It looks like problem is here:

 166         log_daemon_msg "Restarting Plack daemon for ${instancename}"
 167 
 168         if stop_plack $instancename && start_plack $instancename; then
 169             log_end_msg 0
 170         else
 171             log_end_msg 1
 172         fi

We call log_daemon_msg on line 166, then we call the corresponding log_end_msg
on lines 169 or 171. But in between we call stop_plack and start_plack, which
do their own output through log_daemon_msg/log_end_msg, causing the out of line
output. 

I can see a couple of solutions to this:

1. Call log_daemon_msg inside the if:

        if stop_plack $instancename && start_plack $instancename; then
            log_daemon_msg "Restarted Plack daemon for ${instancename}"
            log_end_msg 0
        else
            log_daemon_msg "Could not restart Plack daemon for ${instancename}"
            log_end_msg 1
        fi

This gives output like this:

$ sudo koha-plack --restart kohadev
[ ok ] Stopping Plack daemon for kohadev:.
[ ok ] Starting Plack daemon for kohadev:.
[ ok ] Restarted Plack daemon for kohadev:.

2. Don't call log_daemon_msg at all:

          stop_plack $instancename && start_plack $instancename

This gives us:

$ sudo koha-plack --restart kohadev
[ ok ] Stopping Plack daemon for kohadev:.
[ ok ] Starting Plack daemon for kohadev:.

stop_plack and start_plack will each tell us what they do and if they succeed
or not, so do we really need that third line? 

I will submit a patch for the second solution, but I'm happy to make a patch
for the first solution, if that is the preferred way.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list