I want to schedule a task on Linux by icrontab, and the task is written in python and have to import cx_Oracle
module, so I export ORACLE_HOME
and LD_LIBRARY_PATH
in .bash_profile, but it raise the error:
libclntsh.so.11.1: cannot open shared object file.
Since it is ok to run the task by issue the command in shell like:
python a.py # ok
I change the task in icrontab into a shell script which invoke my Python script, but the exception recurred?
# the shell script scheduled in icrontab #! bash python a.py
Could you help how to do with it?
Possibly you want to specify PATH
— and also ORACLE_HOME
and LD_LIBRARY_PATH
— so that cron(1)
knows where to find binaries.
Read "5 Crontab environment" here.
The libs are located in /u01/app/oracle/product/11.2.0/xe/lib
(For Oracle XE) or similar.
You should add this path to /etc/ld.so.conf
or if this file shows only an include location, as in a separate file in the /etc/ld.so.conf.d
directory
I have oracle.conf in /etc/ld.so.conf.d
, just one file with the path. Nothing else.
Of course don't forget to run ldconfig as a last step.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With