Search code examples
oracleshellcronenvironment-variables

libclntsh.so.11.1: cannot open shared object file.


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?


Solution

  • 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.