On Tue, Sep 4, 2012 at 1:01 PM, Paul <paul.a@aandc.org> wrote:
At 08:00 AM 9/4/2012 -0500, Randall Rowe wrote:
Why would this require a server reboot?
Reboot or logout/login (I just played it safe...)
Also .bashrc env vars dono't affect cron. If you want to insure that cron env variables are set properly edit that users crontab.
Very specifically Koha 3.8.4 on Ubuntu 12.04.1 64-bit (I am NOT necessarily generalizing [1]); the env vars required for user=koha to run a koha-owned cron do not survive reboot. A "proper edit" of crontab gives (see Wiki, install, etc):
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
After a reboot (that does happen in real life, particularly on my sandbox where I established this "proof of concept") the env vars do not survive:
koha@server:/$ printenv|grep koha USER=koha MAIL=/var/mail/koha HOME=/home/koha LOGNAME=koha
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). Saludos To+