[Koha] Running a koha cron job for only one of our libraries
David Cook
dcook at prosentient.com.au
Mon Nov 3 12:18:20 NZDT 2025
Hi Chris,
It's like Joel says. In that scenario, you're pretty much limited to manually putting in the jobs on a per-instance basis.
I think a few of us devs are trying to slowly add more system preference driven controls for controlling which cronjobs are run for which instances, so that koha-foreach iterates through the instances but they only run for particular instances, but it's very slow going.
One thing to add... you'll want to use "koha-shell" to run your cronjob. Under the hood, all koha-foreach is really doing is running the following:
koha-shell ${name} -c "${cmd}";
So you could add to /etc/cron.daily/koha-common the following:
koha-shell INSTANCE -c "/usr/share/koha/bin/cronjobs/longoverdue.pl --parameter 1 --parameter 2"
David Cook
Senior Software Engineer
Prosentient Systems
Suite 7.03
6a Glen St
Milsons Point NSW 2061
Australia
Office: 02 9212 0899
-----Original Message-----
Message: 1
Date: Fri, 31 Oct 2025 16:38:07 +0000
From: Chris Brown <chris at stayawake.co.uk>
To: koha <koha at lists.katipo.co.nz>
Subject: [Koha] Running a koha cron job for only one of our libraries
Message-ID:
<CANo1qi1bdHVsmY1pfhN1s-TJDcRQUNYPo=_sEym_WG9=vbmNVg at mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"
Hello,
Our koha server supports 7 libraries, each with its own database. We are running Koha 22.11.20
We wish to run the cron job longoverdue.pl for only one of the instances. I notice that the cron jobs in /etc/cron.daily/koha-common all use the command "koha-foreach" to run the job for all the enabled instances. Is there a way we can just run the job for just one specific instance?
Thanks!
Chris Brown
------------------------------
Message: 2
Date: Fri, 31 Oct 2025 13:35:47 -0500
From: "Coehoorn, Joel" <jcoehoorn at york.edu>
To: Chris Brown <chris at stayawake.co.uk>
Cc: koha <koha at lists.katipo.co.nz>
Subject: Re: [Koha] Running a koha cron job for only one of our
libraries
Message-ID:
<CAMSeE4YsQBeQhZnK5ZAtj_hg6RMKiqUFaErZDwLdGSvL8RWhTQ at mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"
If the instances each have distinct users on the server, try running the job without the koha-foreach command from the crontab for that specific user.
*Joel Coehoorn*
Director of Information Technology
*York University*
Office: 402-363-5603 | jcoehoorn at york.edu | york.edu
On Fri, Oct 31, 2025 at 11:38 AM Chris Brown <chris at stayawake.co.uk> wrote:
> Hello,
>
> Our koha server supports 7 libraries, each with its own database. We
> are running Koha 22.11.20
>
> We wish to run the cron job longoverdue.pl for only one of the instances.
> I
> notice that the cron jobs in /etc/cron.daily/koha-common all use the
> command "koha-foreach" to run the job for all the enabled instances.
> Is there a way we can just run the job for just one specific instance?
>
> Thanks!
>
> Chris Brown
> _______________________________________________
>
> Koha mailing list http://koha-community.org Koha at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>
More information about the Koha
mailing list