Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Cron revisited

by tweetiepooh (Hermit)
on Jan 10, 2013 at 11:55 UTC ( #1012647=note: print w/replies, xml ) Need Help??

in reply to Cron revisited

Thanks for the replies folk. I appreciate the earlier posts about setting environments either in a wrapper shell or having the Perl script call itself after setting the environment. I use the latter often (in my case to fire off multiple copies of the script with different parameters).

What I'm trying to understand is why the script works on one server but not another and don't really know how to go about finding out what's happening. I know that the issue is with the paths to the Oracle library files but not what the difference is between the two environments. At shell level they look the same and the Perl operates the same.

Is there some setting for cron that has changed between servers? Maybe the parameters I used to build DBD::Oracle were different so the old version doesn't need LD_LIBRARY_PATH? Was there a change in Perl between 5.8 and 5.12 that could have affected this? Difference in the DBD::Oracle module? Difference in the Oracle client? I know there are too many parameters here to get definitive answers but maybe someone knows that in version x of this bit some fix was plopped in to change functionality.

More information - I rebuilt the DBD::Oracle (using -R for runtime pathing) and switching to a user without LD_LIBRARY_PATH set I can see in $ORACLE_HOME but not This is from the shell. If I set LD_LIBRARY_PATH I find both libraries. It's the latter library that's failing in cron.

Replies are listed 'Best First'.
Re^2: Cron revisited
by Old_Gray_Bear (Bishop) on Jan 10, 2013 at 17:41 UTC
    You Said "What I'm trying to understand is why the script works on one server but not another ..."

    Are the two servers configured the same? Exactly the same? Are you sure? (I'll bet they aren't.)

    I Go Back to Sleep, Now.


      Sorry to disturb your hibernation but I know the 2 aren't the same and have stated such in the original posting. Just about everything has changed - OS version, database client, Perl version.

      What I'm trying to figure is what element of that would cause the script to fail in cron on one server but not the other. My feeling is that it's the database client.

        I don't know the cause of your problem, but I've had success with the Solaris/Perl/OracleInstantClient/cron combination by including a BEGIN block in my perl code as below:
        BEGIN { unless (($ENV{BEGIN_BLOCK}) or $^C) { $ENV{ORACLE_HOME} = '/usr/local/instantclient'; $ENV{LD_LIBRARY_PATH} = '/lib:/usr/local/instantclient:/usr/local/ +lib'; $ENV{TNS_ADMIN} = '/apps/admin'; $ENV{BEGIN_BLOCK} = 1; exec 'env',$0,@ARGV; } }
        Obviously you should set your ORACLE_HOME and LD_LIBRARY_PATH env variables to the correct ones for your installations in the above. Note that the TNS_ADMIN env variable tells you where to look for tnsnames.ora.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1012647]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2022-08-14 09:21 GMT
Find Nodes?
    Voting Booth?

    No recent polls found