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 <[email protected]>
To: koha <[email protected]>
Subject: [Koha] Running a koha cron job for only one of our libraries
Message-ID:
        <CANo1qi1bdHVsmY1pfhN1s-TJDcRQUNYPo=_sEym_WG9=vbm...@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" <[email protected]>
To: Chris Brown <[email protected]>
Cc: koha <[email protected]>
Subject: Re: [Koha] Running a koha cron job for only one of our
        libraries
Message-ID:
        <camsee4ysqbeqhznk5zatj_hg6rmkiqufaerzdwldgsvl8rw...@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 | [email protected] | york.edu



On Fri, Oct 31, 2025 at 11:38 AM Chris Brown <[email protected]> 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 [email protected]
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>

_______________________________________________

Koha mailing list  http://koha-community.org
[email protected]
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha

Reply via email to