From ccd4738e26ef3c2e40bfa1dc1e74dfdb94a34239 Mon Sep 17 00:00:00 2001 From: Magnus Enger Date: Mon, 5 Feb 2024 08:12:29 +0000 Subject: [PATCH] Bug 35954: Add --status to koha-plack MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- debian/docs/koha-plack.xml | 8 ++++++++ debian/scripts/koha-plack | 22 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/debian/docs/koha-plack.xml b/debian/docs/koha-plack.xml index 06c0309cd7..0ce060ad53 100644 --- a/debian/docs/koha-plack.xml +++ b/debian/docs/koha-plack.xml @@ -31,6 +31,7 @@ | | | + | | || @@ -84,6 +85,13 @@ + + + + Show the status of Plack for the specified instances. + + + diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack index 6fe1860268..28f5430c72 100755 --- a/debian/scripts/koha-plack +++ b/debian/scripts/koha-plack @@ -43,7 +43,7 @@ $scriptname This script lets you manage the plack daemons for your Koha instances. 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 -h|--help @@ -55,6 +55,7 @@ $scriptname -h|--help requests before restarting them --enable Enable 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-key Specify the key the IDE is expecting --debugger-location Specify the host:port for your debugger tool (defaults @@ -192,6 +193,19 @@ reload_plack() 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() { local instancename=$1 @@ -392,6 +406,9 @@ _do_instance() { "disable") disable_plack $name ;; + "status") + plack_status $name + ;; *) usage ;; @@ -433,6 +450,9 @@ while [ $# -gt 0 ]; do --disable) set_action "disable" shift ;; + --status) + set_action "status" + shift ;; --debugger) debug_mode="yes" shift ;; -- 2.39.5