RE: I have a weird issue with a script running under cron

2014-02-17 Thread L Y Lam
Not like interactive logon, cron does not run your ".profile".
It might be crazy to ask whether you have explicitly executed your ".profile" 
before invoking your Perl script.

L Y

-Original Message-
From: Bruce Johnson [mailto:john...@pharmacy.arizona.edu]
Sent: 18 February, 2014 06:44
Cc: dbi-users@perl.org (dbi-users@perl.org)
Subject: Re: I have a weird issue with a script running under cron


On Feb 17, 2014, at 2:48 PM, John D Groenveld  wrote:

> In message <5302803c.4080...@triad.rr.com>, Richie writes:
>> Is LD_LIBRARY_PATH exported?  It's hard to see whats going on without
>> a full test case.
>
> The OP shouldn't need to set a LD_LIBRARY_PATH so long as he built
> DBD::Oracle with the correct runtime link path, but a simple shell
> script to see which libraries aren't resolving would be a useful test:
> #!/bin/ksh
> /bin/env - /usr/bin/ldd
> /usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so

Everything works on the command line interactively. The error only happens when 
the script is run via cron; however the ORACLE_HOME and LD_LIBRARY_PATH 
variables appear to be set correctly.

This is a fairly lengthy script that hits tables in use during working hours, 
yet depends on remote databases not available to me most of the nights, so it 
may take a few days to work through checking stuff since I only have about two 
hours a day when I can actually run it :-)

--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs




Disclaimer: This email (including any attachments) is for the use of the 
intended recipient only and may contain confidential information and/or 
copyright material. If you are not the intended recipient, please notify the 
sender immediately and delete this email and all copies from your system. Any 
unauthorized use, disclosure, reproduction, copying, distribution, or other 
form of unauthorized dissemination of the contents is expressly prohibited.


Re: I have a weird issue with a script running under cron

2014-02-17 Thread Bruce Johnson

On Feb 17, 2014, at 2:48 PM, John D Groenveld  wrote:

> In message <5302803c.4080...@triad.rr.com>, Richie writes:
>> Is LD_LIBRARY_PATH exported?  It's hard to see whats going on without a 
>> full test case.
> 
> The OP shouldn't need to set a LD_LIBRARY_PATH so long as
> he built DBD::Oracle with the correct runtime link path, but
> a simple shell script to see which libraries aren't resolving
> would be a useful test:
> #!/bin/ksh
> /bin/env - /usr/bin/ldd /usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so

Everything works on the command line interactively. The error only happens when 
the script is run via cron; however the ORACLE_HOME and LD_LIBRARY_PATH 
variables appear to be set correctly.

This is a fairly lengthy script that hits tables in use during working hours, 
yet depends on remote databases not available to me most of the nights, so it 
may take a few days to work through checking stuff since I only have about two 
hours a day when I can actually run it :-)

-- 
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs




Re: I have a weird issue with a script running under cron

2014-02-17 Thread John D Groenveld
In message <5302803c.4080...@triad.rr.com>, Richie writes:
>Is LD_LIBRARY_PATH exported?  It's hard to see whats going on without a 
>full test case.

The OP shouldn't need to set a LD_LIBRARY_PATH so long as
he built DBD::Oracle with the correct runtime link path, but
a simple shell script to see which libraries aren't resolving
would be a useful test:
#!/bin/ksh
/bin/env - /usr/bin/ldd /usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so

John
groenv...@acm.org



Re: I have a weird issue with a script running under cron

2014-02-17 Thread Richie
Is LD_LIBRARY_PATH exported?  It's hard to see whats going on without a 
full test case.



On 2/17/2014 1:50 PM, Bruce Johnson wrote:

On Feb 17, 2014, at 11:41 AM, Bruce Ferrell  wrote:


Bruce,

The error says your script is attempting to load

/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so

for DBD::Oracle.  is that the correct path for that library? it looks like you 
built DBD::Oracle against the Oracle occi libraries and those are often in 
different locations than the regular client libs.  Where is libocci.so.11.1 
located?  Make sure that path is available also.


I built DBD::Oracle against this Instant client install. Both command-line and 
web apps run fine, it’s just this cron job.

[root@merthiolate bin]# find / -name libocci.so.11.1 -print
/usr/lib/oracle/11.2/client64/lib/libocci.so.11.1

Right where it’s supposed to be on $LD_LIBRARY_PATH

Permissions are correct as well :

-rw-r--r-- 1 root root 1971762 Sep 17  2011 
/usr/lib/oracle/11.2/client64/lib/libocci.so.11.1

This is odd…


On 02/17/2014 10:30 AM, Bruce Johnson wrote:

I get the following error:

install_driver(Oracle) failed: Can't load 
'/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: 
libocci.so.11.1: cannot open shared object file: No such file or directory at 
/usr/lib64/perl5/DynaLoader.pm line 200,  line 749.
at (eval 10) line 3
Compilation failed in require at (eval 10) line 3,  line 749.
Perhaps a required shared library or dll isn't installed where expected
at /home/allwebfiles/perl/kfs/kfsupdate.pl line 21

The script runs just fine when run interactively in a shell.

This normally means an issue with Oracle environment variables, but I wrote 
another script that simply lists %ENV. When run in the same crontab I get:

Environment variables
HOME = /root
LD_LIBRARY_PATH = /usr/lib/oracle/11.2/client64/lib
LOGNAME = root
ORACLE_HOME = /usr/lib/oracle/11.2/client64
ORACLE_SID = phmweb
PATH = /usr/bin:/bin
PWD = /root
SHELL = /bin/sh
SHLVL = 1
USER = root
_ = /home/allwebfiles/perl/kfs/showenvcron.pl

These are the correct values.

So what am I missing?





Re: I have a weird issue with a script running under cron

2014-02-17 Thread Bruce Johnson

On Feb 17, 2014, at 11:41 AM, Bruce Ferrell  wrote:

> Bruce,
> 
> The error says your script is attempting to load
> 
> /usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so
> 
> for DBD::Oracle.  is that the correct path for that library? it looks like 
> you built DBD::Oracle against the Oracle occi libraries and those are often 
> in different locations than the regular client libs.  Where is 
> libocci.so.11.1 located?  Make sure that path is available also.
> 

I built DBD::Oracle against this Instant client install. Both command-line and 
web apps run fine, it’s just this cron job.

[root@merthiolate bin]# find / -name libocci.so.11.1 -print
/usr/lib/oracle/11.2/client64/lib/libocci.so.11.1

Right where it’s supposed to be on $LD_LIBRARY_PATH

Permissions are correct as well :

-rw-r--r-- 1 root root 1971762 Sep 17  2011 
/usr/lib/oracle/11.2/client64/lib/libocci.so.11.1

This is odd…

> 
> On 02/17/2014 10:30 AM, Bruce Johnson wrote:
>> I get the following error:
>> 
>> install_driver(Oracle) failed: Can't load 
>> '/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: 
>> libocci.so.11.1: cannot open shared object file: No such file or directory 
>> at /usr/lib64/perl5/DynaLoader.pm line 200,  line 749.
>> at (eval 10) line 3
>> Compilation failed in require at (eval 10) line 3,  line 749.
>> Perhaps a required shared library or dll isn't installed where expected
>> at /home/allwebfiles/perl/kfs/kfsupdate.pl line 21
>> 
>> The script runs just fine when run interactively in a shell.
>> 
>> This normally means an issue with Oracle environment variables, but I wrote 
>> another script that simply lists %ENV. When run in the same crontab I get:
>> 
>> Environment variables
>> HOME = /root
>> LD_LIBRARY_PATH = /usr/lib/oracle/11.2/client64/lib
>> LOGNAME = root
>> ORACLE_HOME = /usr/lib/oracle/11.2/client64
>> ORACLE_SID = phmweb
>> PATH = /usr/bin:/bin
>> PWD = /root
>> SHELL = /bin/sh
>> SHLVL = 1
>> USER = root
>> _ = /home/allwebfiles/perl/kfs/showenvcron.pl
>> 
>> These are the correct values.
>> 
>> So what am I missing?
>> 
> 

-- 
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs




Re: I have a weird issue with a script running under cron

2014-02-17 Thread Jens Rehsack
Hi Bruce,


Am 17.02.2014 um 19:30 schrieb Bruce Johnson :

> I get the following error:
> 
> install_driver(Oracle) failed: Can't load 
> '/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: 
> libocci.so.11.1: cannot open shared object file: No such file or directory at 
> /usr/lib64/perl5/DynaLoader.pm line 200,  line 749.
> at (eval 10) line 3
> Compilation failed in require at (eval 10) line 3,  line 749.
> Perhaps a required shared library or dll isn't installed where expected
> at /home/allwebfiles/perl/kfs/kfsupdate.pl line 21
> 
> The script runs just fine when run interactively in a shell.
> 
> This normally means an issue with Oracle environment variables, but I wrote 
> another script that simply lists %ENV. When run in the same crontab I get:
> 
> Environment variables 
> HOME = /root
> LD_LIBRARY_PATH = /usr/lib/oracle/11.2/client64/lib
> LOGNAME = root
> ORACLE_HOME = /usr/lib/oracle/11.2/client64
> ORACLE_SID = phmweb
> PATH = /usr/bin:/bin
> PWD = /root
> SHELL = /bin/sh
> SHLVL = 1
> USER = root
> _ = /home/allwebfiles/perl/kfs/showenvcron.pl
> 
> These are the correct values.
> 
> So what am I missing?

try an ldd on /usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so and any dependent
library beside standard library paths to see what might be missing. Optionally
a locate for libocci.so.11.1 might be helpful.

Cheers
-- 
Jens Rehsack
rehs...@gmail.com







Re: I have a weird issue with a script running under cron

2014-02-17 Thread Bruce Ferrell

Bruce,

The error says your script is attempting to load

/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so

for DBD::Oracle.  is that the correct path for that library? it looks like you built DBD::Oracle against the Oracle occi libraries and those are often in different locations than 
the regular client libs.  Where is libocci.so.11.1 located?  Make sure that path is available also.



On 02/17/2014 10:30 AM, Bruce Johnson wrote:

I get the following error:

install_driver(Oracle) failed: Can't load 
'/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: 
libocci.so.11.1: cannot open shared object file: No such file or directory at 
/usr/lib64/perl5/DynaLoader.pm line 200,  line 749.
at (eval 10) line 3
Compilation failed in require at (eval 10) line 3,  line 749.
Perhaps a required shared library or dll isn't installed where expected
at /home/allwebfiles/perl/kfs/kfsupdate.pl line 21

The script runs just fine when run interactively in a shell.

This normally means an issue with Oracle environment variables, but I wrote 
another script that simply lists %ENV. When run in the same crontab I get:

Environment variables
HOME = /root
LD_LIBRARY_PATH = /usr/lib/oracle/11.2/client64/lib
LOGNAME = root
ORACLE_HOME = /usr/lib/oracle/11.2/client64
ORACLE_SID = phmweb
PATH = /usr/bin:/bin
PWD = /root
SHELL = /bin/sh
SHLVL = 1
USER = root
_ = /home/allwebfiles/perl/kfs/showenvcron.pl

These are the correct values.

So what am I missing?





I have a weird issue with a script running under cron

2014-02-17 Thread Bruce Johnson
I get the following error:

install_driver(Oracle) failed: Can't load 
'/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: 
libocci.so.11.1: cannot open shared object file: No such file or directory at 
/usr/lib64/perl5/DynaLoader.pm line 200,  line 749.
at (eval 10) line 3
Compilation failed in require at (eval 10) line 3,  line 749.
Perhaps a required shared library or dll isn't installed where expected
at /home/allwebfiles/perl/kfs/kfsupdate.pl line 21

The script runs just fine when run interactively in a shell.

This normally means an issue with Oracle environment variables, but I wrote 
another script that simply lists %ENV. When run in the same crontab I get:

Environment variables 
HOME = /root
LD_LIBRARY_PATH = /usr/lib/oracle/11.2/client64/lib
LOGNAME = root
ORACLE_HOME = /usr/lib/oracle/11.2/client64
ORACLE_SID = phmweb
PATH = /usr/bin:/bin
PWD = /root
SHELL = /bin/sh
SHLVL = 1
USER = root
_ = /home/allwebfiles/perl/kfs/showenvcron.pl

These are the correct values.

So what am I missing?

-- 
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs