Bug 40901: (QA follow-up) Move ES indexer re-discovery into koha-systemd-ctl
koha-common.service had an unexplained one-line shell loop in ExecStartPre. It's now a documented sync-es-indexers command in koha-systemd-ctl that does the same thing: notice instances that switched to Elasticsearch and start their indexers, like the SysV init script did on every start. https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40901#c132 Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
a46f1aa4ca
commit
7169ea9e2d
|
|
@ -7,7 +7,9 @@ After=koha.target
|
|||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStartPre=+/bin/sh -c 'for i in $(koha-list --enabled --elasticsearch 2>/dev/null); do systemctl enable --now "koha-es-indexer@$i.service" 2>/dev/null || true; done'
|
||||
# Instances can switch to Elasticsearch after their units were enabled, so
|
||||
# re-discover ES indexers on every start, like the SysV init script did.
|
||||
ExecStartPre=-/usr/sbin/koha-systemd-ctl sync-es-indexers
|
||||
ExecStart=/bin/true
|
||||
ExecStop=/bin/systemctl stop koha.target
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ Commands:
|
|||
restart <instance> <svc> Restart specific service for instance
|
||||
status <instance> <svc> Show status of specific service for instance
|
||||
|
||||
sync-es-indexers Enable and start the ES indexer for every
|
||||
instance configured to use Elasticsearch
|
||||
|
||||
Services: plack, zebra, sip, z3950, worker, worker-long_tasks, indexer, es-indexer
|
||||
|
||||
Examples:
|
||||
|
|
@ -33,6 +36,17 @@ EOF
|
|||
exit 1
|
||||
}
|
||||
|
||||
if [ "${1:-}" = "sync-es-indexers" ]; then
|
||||
# Which search engine an instance uses is plain koha-conf.xml state, so
|
||||
# switching an instance to Elasticsearch never runs 'systemctl enable'.
|
||||
# Re-discover ES instances here, like the SysV init script did on every
|
||||
# start.
|
||||
for instance in $(koha-list --enabled --elasticsearch 2>/dev/null); do
|
||||
systemctl enable --now "koha-es-indexer@${instance}.service" || true
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
[ $# -lt 2 ] && usage
|
||||
|
||||
CMD=$1
|
||||
|
|
|
|||
Loading…
Reference in New Issue