http://www.perlmonks.org?node_id=1012532

tweetiepooh has asked for the wisdom of the Perl Monks concerning the following question:

Hello all and happy new year

Having a fun issue with moving some scripts to a new server. On the old Solaris 8 with full fat Oracle 8 client and Perl 5.8 scripts run nicely under cron, generating output and working well.

On the new Solaris 10 with instant client 10_2 and Perl 5.12 the scripts work under shell but under cron fail with error finding libraries. (As others have found.)

Put a new script that fails on new server to old server and it works under cron, same script, no changes.

So this is not likely to be a pure Perl issue but maybe someone here has some ideas.
Update : OK the error seen is that the library libnnz10.so isn't found. I left this out initially because then I'd just get told about LD_LIBRARY_PATH and similar. These have been written up in the past and I am aware of it. I was after seeing if folk know why I get such an error with the Instant Client but not the older full client install.

Replies are listed 'Best First'.
Re: Cron revisited
by blue_cowdawg (Monsignor) on Jan 09, 2013 at 18:18 UTC

    What the Monk of Mystery is trying to tell you and I imagine has been mentioned elsewhere on the Monastery pages: any time the phrase "works in shell but not under <fill in the blank>" you need to check your environment where it works and where it doesn't and determine the differences. Twas ever thus.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Re: Cron revisited
by Anonymous Monk on Jan 09, 2013 at 17:55 UTC
Re: Cron revisited
by tweetiepooh (Hermit) on Jan 10, 2013 at 11:55 UTC

    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 libclntsh.so.10.1 in $ORACLE_HOME but not libnnz10.so. 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.

      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.

      OGB

        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.