From bf50c69a3bdeb0a46b93362152ac26d76496597c Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Tue, 7 Jun 2022 05:42:20 +0000 Subject: [PATCH] Bug 30684: When a service isn't running koha-* scripts --restart should start it Test plan: 1. Stop plack, indexer, sip, worker, z3950 and zebra. Note: To test Z39.50 restarting you will need to setup the server: https://wiki.koha-community.org/wiki/Setting_up_the_Z39.50_and_SRU_Server#Setting_up_the_Z39.50_and_SRU_Server 2. Run restart command for each service: - [Plack] sudo koha-plack --restart {instance} - [Indexer] sudo koha-indexer --restart {instance} - [SIP] sudo koha-sip --restart {instance} - [Worker] sudo koha-worker --restart {instance} - [z3950] sudo koha-z3950-responder --restart {instance} - [Zebra] sudo koha-zebra --restart {instance} 3. Observe the services do not get restarted. Instead you get an error saying the service is not running 4. Apply patch 5. If you are using kohadevbox you must copy koha-* scripts to /usr/sbin/: sudo cp debian/scripts/koha-plack /usr/sbin/koha-plack sudo cp debian/scripts/koha-indexer /usr/sbin/koha-indexer sudo cp debian/scripts/koha-sip /usr/sbin/koha-sip sudo cp debian/scripts/koha-worker /usr/sbin/koha-worker sudo cp debian/scripts/koha-z3950-responder /usr/sbin/koha-z3950-responder sudo cp debian/scripts/koha-zebra /usr/sbin/koha-zebra 6. Repeat step 2 7. This time confirm that each service is restarted Sponsored-by: Catalyst IT --- debian/scripts/koha-indexer | 4 ++-- debian/scripts/koha-plack | 4 ++-- debian/scripts/koha-sip | 5 +++-- debian/scripts/koha-worker | 4 ++-- debian/scripts/koha-z3950-responder | 4 ++-- debian/scripts/koha-zebra | 5 +++-- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/debian/scripts/koha-indexer b/debian/scripts/koha-indexer index 4635d2b40a..6a44b65b91 100755 --- a/debian/scripts/koha-indexer +++ b/debian/scripts/koha-indexer @@ -134,8 +134,8 @@ restart_indexer() log_end_msg 1 fi else - log_daemon_msg "Error: Indexer not running for $name" - log_end_msg 1 + log_daemon_msg "Indexer not running for $name." + start_indexer $name fi } diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack index 3dcce331a9..1709aac6e0 100755 --- a/debian/scripts/koha-plack +++ b/debian/scripts/koha-plack @@ -164,8 +164,8 @@ restart_plack() if is_plack_running ${instancename}; then stop_plack $instancename && start_plack $instancename else - log_daemon_msg "Error: Plack not running for ${instancename}" - log_end_msg 1 + log_daemon_msg "Plack not running for ${instancename}." + start_plack $instancename fi } diff --git a/debian/scripts/koha-sip b/debian/scripts/koha-sip index 402e9fa2e3..3fde2a6806 100755 --- a/debian/scripts/koha-sip +++ b/debian/scripts/koha-sip @@ -167,9 +167,10 @@ restart_sip() echo $noLF `start_sip ${name}` else if [ "$verbose" != "no" ]; then - log_daemon_msg "Warning: SIP server not running for ${name}" - log_end_msg 0 + log_daemon_msg "Warning: SIP server not running for ${name}." + start_sip ${name} else + start_sip ${name} return 0 fi fi diff --git a/debian/scripts/koha-worker b/debian/scripts/koha-worker index 3d3f26257f..76863b6a26 100755 --- a/debian/scripts/koha-worker +++ b/debian/scripts/koha-worker @@ -144,8 +144,8 @@ restart_worker() log_end_msg 1 fi else - log_daemon_msg "Error: worker not running for $name ($queue)" - log_end_msg 1 + log_daemon_msg "Worker not running for $name ($queue)." + start_worker $name $queue fi } diff --git a/debian/scripts/koha-z3950-responder b/debian/scripts/koha-z3950-responder index 7f34bb4736..56c63d10a6 100755 --- a/debian/scripts/koha-z3950-responder +++ b/debian/scripts/koha-z3950-responder @@ -167,8 +167,8 @@ restart_z3950() log_end_msg 1 fi else - log_daemon_msg "Error: Z39.50/SRU not running for ${instancename}" - log_end_msg 1 + log_daemon_msg "Z39.50/SRU not running for ${instancename}." + start_z3950 $instancename fi } diff --git a/debian/scripts/koha-zebra b/debian/scripts/koha-zebra index 0bd11aa7bc..b297611c75 100755 --- a/debian/scripts/koha-zebra +++ b/debian/scripts/koha-zebra @@ -146,9 +146,10 @@ restart_zebra() echo $noLF `start_zebra ${name}` else if [ "$verbose" != "no" ]; then - log_daemon_msg "Error: Zebra not running for ${name}" - log_end_msg 1 + log_daemon_msg "Zebra not running for ${name}." + start_zebra ${name} else + start_zebra ${name} return 1 fi fi -- 2.20.1