From 24581a408b80f8927e00afddfb6e3a20b45d9fc3 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Fri, 17 Feb 2023 12:00:49 +0000
Subject: [PATCH] Bug 32992: Move background_jobs_worker to misc/workers

On bug 32594 we are adding a new worker, dedicated to Elastic indexing.
We should have a common place for workers, and we agreed on misc/workers

To test:
1 - Apply patch
2 - reset_all in koha testing docker
3 - ps aux | grep background
4 - Confirm the workers are running, and running in the new directory
5 - Perform a batch item modification
6 - Ensure the job is processed by the worker

Signed-off-by: David Nind <david@davidnind.com>
---
 debian/scripts/koha-worker                   | 4 ++--
 debian/templates/koha-worker@.service        | 2 +-
 etc/koha-worker.service                      | 2 +-
 misc/{ => workers}/background_jobs_worker.pl | 0
 4 files changed, 4 insertions(+), 4 deletions(-)
 rename misc/{ => workers}/background_jobs_worker.pl (100%)

diff --git a/debian/scripts/koha-worker b/debian/scripts/koha-worker
index e62114cade..8889405b4b 100755
--- a/debian/scripts/koha-worker
+++ b/debian/scripts/koha-worker
@@ -212,9 +212,9 @@ done
 adjust_paths_dev_install $1
 
 if [ "$DEV_INSTALL" = "" ]; then
-    worker_DAEMON="${KOHA_HOME}/bin/background_jobs_worker.pl"
+    worker_DAEMON="${KOHA_HOME}/bin/workers/background_jobs_worker.pl"
 else
-    worker_DAEMON="${KOHA_HOME}/misc/background_jobs_worker.pl"
+    worker_DAEMON="${KOHA_HOME}/misc/workers/background_jobs_worker.pl"
 fi
 
 # PERL5LIB has been read from etc/default
diff --git a/debian/templates/koha-worker@.service b/debian/templates/koha-worker@.service
index 826ae87abc..1450a627e1 100644
--- a/debian/templates/koha-worker@.service
+++ b/debian/templates/koha-worker@.service
@@ -8,7 +8,7 @@ After=syslog.target network.target
 User=%i-koha
 Environment=PERL5LIB=/usr/share/koha/lib
 Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml
-ExecStart=/usr/share/koha/bin/background_jobs_worker.pl
+ExecStart=/usr/share/koha/bin/workers/background_jobs_worker.pl
 Restart=on-failure
 RestartSec=5s
 StartLimitBurst=3
diff --git a/etc/koha-worker.service b/etc/koha-worker.service
index e53ab30e0f..1f9de4c9b0 100644
--- a/etc/koha-worker.service
+++ b/etc/koha-worker.service
@@ -6,7 +6,7 @@ After=syslog.target network.target
 [Service]
 Environment=PERL5LIB=__PERL5LIB_DIRS__
 Environment=KOHA_CONF=__KOHA_CONF_DIR__/koha-conf.xml
-ExecStart=__SCRIPT_DIR__/background_jobs_worker.pl
+ExecStart=__SCRIPT_DIR__/workers/background_jobs_worker.pl
 Restart=on-failure
 RestartSec=5s
 StartLimitBurst=3
diff --git a/misc/background_jobs_worker.pl b/misc/workers/background_jobs_worker.pl
similarity index 100%
rename from misc/background_jobs_worker.pl
rename to misc/workers/background_jobs_worker.pl
-- 
2.30.2