Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Runs fine on cmd line but not in cron
I understand a cron environment lacks a lot of environment variables. But this time I couldn't figure out. I already added most relevant variables to %ENV and it still only runs on command line but fails in cron: ORACLE_HOME, ORACLE_SID, TNS_ADMIN, TWO_TASK, LD_LIBRARY_PATH, even tried adding USER, LOGNAME, PATH etc. I also made sure @INC is the same inside cron environment as on command line. The user running this cron always gets this email after the cron is run:
produced the following output:
install_driver(Oracle) failed: Can't
load '/usr/local/lib/perl5/site_perl/sun4-
solaris/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle:
ld.so.1: /usr/local/bin/perl: fatal: libclntsh.so.8.0: open failed: No
such file or directory at /usr/local/lib/perl5/sun4-
solaris/5.00404/DynaLoader.pm line 166.
at (eval 6) line 2
at /export/home/www/emailnotify.pl line 22
The file libclntsh.so.8.0 and its symlink libclntsh.so are both in LD_LIBRARY_PATH. Permission is set to readable. What's more, the perl script (for this cron job) does NOT die on this line (which is line 22):
die "Can't connect to DB!" unless ($dbh=DBI->connect ("dbi:Oracle:STGFNDO8","iptest","thepassword",RaiseError=>0,AutoCommit=> 0,PrintError=>1}));
because I don't see the "Can't connect" message printed and I can see my "print"ed strings below this line for debugging.
I spent too much time trying to figure out and gave up. What could I be missing? Can anyone help? Thanks a lot.
-- Yong Huang (yong321_at_yahoo.com) Sent via Deja.com http://www.deja.com/ Before you buy.Received on Fri Jun 16 2000 - 00:00:00 CDT