从cron
运行时在脚本上出错error while loading shared libraries: libclntsh.so.11.1: cannot open shared object file: No such file or directory
当我从命令行运行它时,我没有收到错误。
所以我在库上找到命令并找到它:
locate - /export/home/orahome/11.2/lib/libclntsh.so.11.1
并将其添加到脚本中路径的末尾,但仍然会出错。
#!/bin/bash
export PATH=/opt/OV/bin/OpC:/usr/local/sqlite3.6.23.1/bin:/production/java/jdk32 /bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/svn/bin: /orahome/current/bin:/production/
fo/bin:/production/fo/scr:/production/fo/tools:/export/home/orahome/11.2/lib/
/production/bin/userStats -c /production/cfg/userStats.cfg > /production/log/userStats.log 2>&1
但仍然在日志中出现错误
casper@casperbox:> ls -ltr /production/log/userStats.log
-rw-r - r-- 1 casper casper 145 Oct 24 16:24 /production/log/userStats.log
casper@casperbox:> more /production/log/userStats.log
/production/bin/userStats: error while loading shared libraries: libclntsh.so.11.1:
cannot open shared object file: No such file or directory
答案 0 :(得分:1)
您需要将其附加到LD_LIBRARY_PATH
,而不是PATH
。