Bug 14466 - is_zebra_running in koha-functions.sh is broken
Summary: is_zebra_running in koha-functions.sh is broken
Status: RESOLVED DUPLICATE of bug 14361
Alias: None
Product: Koha
Classification: Unclassified
Component: Packaging (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Mirko Tietgen
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-26 13:47 UTC by Mirko Tietgen
Modified: 2015-06-28 19:55 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 14466 -- is_zebra_running in koha-functions.sh is broken (1.82 KB, patch)
2015-06-28 12:32 UTC, Mirko Tietgen
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mirko Tietgen 2015-06-26 13:47:20 UTC
koha-start-zebra pbuilder
Starting Zebra server for pbuilder

build@vps181114:~$ ps aux | grep zebra
1002      6894  0.0  0.0  20000   552 ?        S    15:41   0:00 daemon --name=pbuilder-koha-zebra --pidfiles=/var/run/koha/pbuilder/ --errlog=/var/log/koha/pbuilder/zebra-error.log --stdout=/var/log/koha/pbuilder/zebra.log --output=/var/log/koha/pbuilder/zebra-output.log --verbose=1 --respawn --delay=30 --user=pbuilder-koha.pbuilder-koha -- zebrasrv -v none,fatal,warn -f /etc/koha/sites/pbuilder/koha-conf.xml
1002      6895  0.3  0.4 104320  4724 ?        S    15:41   0:00 zebrasrv -v none,fatal,warn -f /etc/koha/sites/pbuilder/koha-conf.xml


koha-stop-zebra pbuilder
Zebra already stopped for instance pbuilder.

ps aux | grep zebra
1002      6894  0.0  0.0  20000   552 ?        S    15:41   0:00 daemon --name=pbuilder-koha-zebra --pidfiles=/var/run/koha/pbuilder/ --errlog=/var/log/koha/pbuilder/zebra-error.log --stdout=/var/log/koha/pbuilder/zebra.log --output=/var/log/koha/pbuilder/zebra-output.log --verbose=1 --respawn --delay=30 --user=pbuilder-koha.pbuilder-koha -- zebrasrv -v none,fatal,warn -f /etc/koha/sites/pbuilder/koha-conf.xml
1002      6895  0.0  0.4 104320  4724 ?        S    15:41   0:00 zebrasrv -v none,fatal,warn -f /etc/koha/sites/pbuilder/koha-conf.xml
build     6944  0.0  0.0  11480   948 pts/0    S+   15:46   0:00 grep zebra
Comment 1 Mirko Tietgen 2015-06-26 13:51:20 UTC
This also has the effect that other commands do not work. If I disable and delete an instance, the user is still in use (running daemon and zebrasrv), can't be deleted, the dead conf symlink remains in /etc/apache2/sites-enabled, apache goes crazy over it and tells me to install stuff, zombie apocalypse starts and it all has to be cleaned up manually.
Comment 2 Mirko Tietgen 2015-06-28 11:53:17 UTC
Looks like the check is_zebra_running does not work.
Comment 3 Mirko Tietgen 2015-06-28 11:56:55 UTC
daemon --name="koha-koha-zebra" --user="koha-koha.koha-koha" --running

in the command line does not give me any feedback, regardless of the actual state. Should it?
Comment 4 Mirko Tietgen 2015-06-28 12:32:33 UTC
Created attachment 40705 [details] [review]
Bug 14466 -- is_zebra_running in koha-functions.sh is broken

is_zebra_running is broken, so koha-stop-zebra is broken too.
daemon needs the --pidfiles if given at start, and the --running
argumen has to be used before that.

Beware that the path to koha-functions.sh in the koha- scripts
is hardcoded for package installations (/usr/share…), so you need
to change it to match koha-functions.sh in your dev environment
to test this patch.

Test plan:

- Use koha-stop-zebra with an instance that has a running zebra.
It will tell you that zebra was already stopped.
- ps aux | grep zebra to see that is not true
- Apply patch. Modify koha-stop-zebra to use
  /your/devpath/debian/scripts/koha-functions.sh
- Use koha-stop-zebra. You will be told zebra is stopped now for
  your instance
- ps aux | grep zebra to verify it is gone
Comment 5 Mirko Tietgen 2015-06-28 12:37:49 UTC
Small addition to the test plan:

- Use koha-stop-zebra again. You will now (correctly) be told that zebra is already stopped for your instance.
Comment 6 Mirko Tietgen 2015-06-28 12:42:32 UTC
Would be nice if this could go into 3.18 too.
Comment 7 Mirko Tietgen 2015-06-28 12:49:06 UTC
(In reply to Mirko Tietgen from comment #3)
> daemon --name="koha-koha-zebra" --user="koha-koha.koha-koha" --running
> 
> in the command line does not give me any feedback, regardless of the actual
> state. Should it?

It does with --verbose, btw.
Comment 8 M. Tompsett 2015-06-28 16:50:02 UTC
(In reply to Mirko Tietgen from comment #3)
> daemon --name="koha-koha-zebra" --user="koha-koha.koha-koha" --running
> 
> in the command line does not give me any feedback, regardless of the actual
> state. Should it?

Perhaps check "echo $?" (without the double quotes)?
Comment 9 M. Tompsett 2015-06-28 17:33:35 UTC
(In reply to Mirko Tietgen from comment #0)
> ps aux | grep zebra
> 1002      6894  0.0  0.0  20000   552 ?        S    15:41   0:00 daemon
> --name=pbuilder-koha-zebra --pidfiles=/var/run/koha/pbuilder/
> --errlog=/var/log/koha/pbuilder/zebra-error.log
> --stdout=/var/log/koha/pbuilder/zebra.log
> --output=/var/log/koha/pbuilder/zebra-output.log --verbose=1 --respawn
> --delay=30 --user=pbuilder-koha.pbuilder-koha -- zebrasrv -v none,fatal,warn
> -f /etc/koha/sites/pbuilder/koha-conf.xml
> 1002      6895  0.0  0.4 104320  4724 ?        S    15:41   0:00 zebrasrv -v
> none,fatal,warn -f /etc/koha/sites/pbuilder/koha-conf.xml
> build     6944  0.0  0.0  11480   948 pts/0    S+   15:46   0:00 grep zebra

When did --pidfiles get added? It's not in 3.14.x or 3.16.x as far as I know.
Comment 10 Mirko Tietgen 2015-06-28 19:55:26 UTC

*** This bug has been marked as a duplicate of bug 14361 ***