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

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Alex Buckley 2022-06-07 05:42:20 +00:00 committed by Tomas Cohen Arazi
parent cbe50d798a
commit 3227b6136d
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
6 changed files with 14 additions and 12 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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