Bug 35954: Add --status to koha-plack

This adds a --status switch to the koha-plack command.

To test on ktd:
- Copy the script to /usr/sbin, so you run the modified script,
  and not the one installed by Koha:
  $ sudo cp debian/scripts/koha-plack /usr/sbin/
- Stop and start Plack for kohadev like so:
  $ sudo koha-plack --stop kohadev
  $ sudo koha-plack --start kohadev
  And make sure this reports the correct status, both when Plack
  is running and when it is not running:
  $ sudo koha-plack --status kohadev
- Make sure --status is mentioned here:
  $ sudo koha-plack --help
- See https://wiki.koha-community.org/wiki/Testing_man_pages for
  details on how to check the manual page for the command

Signed-off-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ccd4738e26)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Magnus Enger 2024-02-05 08:12:29 +00:00 committed by Fridolin Somers
parent bc8788cf93
commit 85c8d5f10c
2 changed files with 29 additions and 1 deletions

View file

@ -31,6 +31,7 @@
<option>--reload</option>| <option>--reload</option>|
<option>--enable</option>| <option>--enable</option>|
<option>--disable</option>| <option>--disable</option>|
<option>--status</option>|
<option>--help</option>|<option>-h</option> <option>--help</option>|<option>-h</option>
|<option>--quiet</option>|<option>-q</option> |<option>--quiet</option>|<option>-q</option>
</arg> </arg>
@ -84,6 +85,13 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><option>--status</option></term>
<listitem>
<para>Show the status of Plack for the specified instances.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>--quiet|-q</option></term> <term><option>--quiet|-q</option></term>
<listitem> <listitem>

View file

@ -43,7 +43,7 @@ $scriptname
This script lets you manage the plack daemons for your Koha instances. This script lets you manage the plack daemons for your Koha instances.
Usage: Usage:
$scriptname --start|--stop|--restart|--reload [--quiet|-q] instancename1 [instancename2...] $scriptname --start|--stop|--restart|--reload|--status [--quiet|-q] instancename1 [instancename2...]
$scriptname --enable|--disable instancename1 [instancename2] $scriptname --enable|--disable instancename1 [instancename2]
$scriptname -h|--help $scriptname -h|--help
@ -55,6 +55,7 @@ $scriptname -h|--help
requests before restarting them requests before restarting them
--enable Enable plack for the specified instances --enable Enable plack for the specified instances
--disable Disable plack for the specified instances --disable Disable plack for the specified instances
--status Show the status of Plack for the specified instances
--debugger Enable running Plack in debug mode --debugger Enable running Plack in debug mode
--debugger-key Specify the key the IDE is expecting --debugger-key Specify the key the IDE is expecting
--debugger-location Specify the host:port for your debugger tool (defaults --debugger-location Specify the host:port for your debugger tool (defaults
@ -192,6 +193,19 @@ reload_plack()
fi fi
} }
plack_status()
{
local name=$1
if is_plack_running ${name}; then
log_daemon_msg "Plack running for ${name}"
log_end_msg 0
else
log_daemon_msg "Plack not running for ${name}"
log_end_msg 3
fi
}
enable_plack() enable_plack()
{ {
local instancename=$1 local instancename=$1
@ -392,6 +406,9 @@ _do_instance() {
"disable") "disable")
disable_plack $name disable_plack $name
;; ;;
"status")
plack_status $name
;;
*) *)
usage usage
;; ;;
@ -433,6 +450,9 @@ while [ $# -gt 0 ]; do
--disable) --disable)
set_action "disable" set_action "disable"
shift ;; shift ;;
--status)
set_action "status"
shift ;;
--debugger) --debugger)
debug_mode="yes" debug_mode="yes"
shift ;; shift ;;