At 01:06 PM 9/4/2012 -0300, Tomas Cohen Arazi wrote:
On Tue, Sep 4, 2012 at 1:01 PM, Paul <pau...@aandc.org> wrote:
[snip]
> KOHA_CONF=/etc/koha/koha-conf.xml
> KOHAPATH=/usr/share/koha
> PERL5LIB=$KOHAPATH/lib
> */1 * * * *    koha    $KOHAPATH/bin/migration_tools/rebuild_zebra.pl -a -b
> -z &> /dev/null
[snip]
> and the cron rebuild_zebra.pl -a -b -z fails [Can't locate C4/Context.pm in
> @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2
> /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5
> /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at
> /usr/share/koha/bin/migration_tools/rebuild_zebra.pl line 6.
> BEGIN failed--compilation aborted at
> /usr/share/koha/bin/migration_tools/rebuild_zebra.pl line 6.]

That's correct. A shell like bash needs those variables defined in its
scope to have them available. The scope of those variables defined in
the crontab includes JUST the commands run from the crontab (think of
it as a shell itself).

I appreciate the theory that /etc/cron.d/koha (as I quoted it above) should|could|would pick up the variables KOHA_CONF, KOHAPATH and PERL5LIB

In fact I think this worked for Koha 3.6.7 on Ubuntu 12.04 *i386* (from my notes, no errors; but that install has been trashed) -- but it does NOT work on either of our two 64 bit servers -- hence the need to add the 'export' lines to /home/koha.bashrc and make them available *before* the cron job is called.

I have not had time to find out *why* the 32- and 64-bit builds possibly differ and satisfy my curiosity. All I've done is come up with a working solution and share it with this community -- with the caveat that YMMV and there might well be other [more elegant?] ways around it.

Best - Paul

_______________________________________________
Koha mailing list  http://koha-community.org
Koha@lists.katipo.co.nz
http://lists.katipo.co.nz/mailman/listinfo/koha

Reply via email to