Bug 31124: Make koha-remove stop all workers
This patch makes two things:
* Adds a `get_worker_queues` function to koha-functions.sh
* Makes `koha-remove` loop through all the defined queues to stop all
the running workers before trying to remove the unix user for the
instance.
To test:
1. Run:
$ ktd --shell
k$ sudo -s
k$ koha-create --create-db test1
k$ service koha-common restart
k$ koha-remove test1
=> FAIL: There's an error about not being able to drop the instance user
2. Run:
k$ ps -ef | grep test1
=> FAIL: There's a running process for the 'long_tasks' queue worker.
3. Apply this patch
4. Run:
k$ cp debian/scripts/koha-functions.sh \
/usr/share/koha/bin/koha-functions.sh
5. Repeat 1 naming the instance `test2`
=> SUCCESS: The instance is removed correctly. No error about running
processes
=> SUCCESS: No process is running for `test2`
6. Sign off :-D
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 576c496442)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
parent
c3a9ef0989
commit
86fd02bd1a
|
|
@ -242,6 +242,13 @@ get_worker_name()
|
|||
fi
|
||||
}
|
||||
|
||||
get_worker_queues()
|
||||
{
|
||||
for queue in default long_tasks; do
|
||||
echo $queue
|
||||
done;
|
||||
}
|
||||
|
||||
is_plack_enabled_opac()
|
||||
{
|
||||
local instancefile=$1
|
||||
|
|
|
|||
|
|
@ -81,10 +81,12 @@ eof
|
|||
if is_indexer_running $name; then
|
||||
koha-indexer --stop $name || /bin/true
|
||||
fi
|
||||
# Stop the worker daemon if needed
|
||||
if is_worker_running $name; then
|
||||
koha-worker --stop $name || /bin/true
|
||||
fi
|
||||
# Stop the worker daemons if needed
|
||||
for queue in $(get_worker_queues); do
|
||||
if is_worker_running $name $queue; then
|
||||
koha-worker --queue $queue --stop $name|| /bin/true
|
||||
fi
|
||||
done
|
||||
# Stop the Plack server if needed
|
||||
if is_plack_running $name; then
|
||||
koha-plack --stop $name || /bin/true
|
||||
|
|
|
|||
Loading…
Reference in New Issue