+ -
当前位置:首页 → 问答吧 → perl 用crontab 调用 环境变量的问题

perl 用crontab 调用 环境变量的问题

时间:2010-10-10

来源:互联网

PERL 使用DBI 连接数据库
直接执行 perl connmysql.pl  可以完美执行
但是用crontab 调用connmysql.pl  提示缺少
Compilation failed in require at (eval 5) line 3.
Perhaps a required shared library or dll isn't installed where expected
install_driver(mysql) failed: Can't load 'mysql.so' for module DBD::mysql: libmysql
client.so.16: cannot open shared object file: Permission denied at DynaLoader.pm line 230.

在connmysql.pl内容中添加 在.bash_profile 相对应得EXPORT的值,还是出现上面的故障
$ENV{'PATH'}
$ENV{'LD_LIBRARY_PATH'}
$ENV{'PERL5LIB'}

求此类问题的解决方法
PERL大拿帮助呀

作者: ztj2247   发布时间: 2010-10-10

一个建议是
crontab 命令中,先执行一下. .bash_profile

作者: 珞水的大叔   发布时间: 2010-10-10



QUOTE:
一个建议是
crontab 命令中,先执行一下. .bash_profile
珞水的大叔 发表于 2010-10-10 21:00




    是在CRONTAB中这样写吗

* * * * * . ~/.bash_profile  connmysql.pl >> connmysql.log 2>&1 &

作者: ztj2247   发布时间: 2010-10-10

回复 ztj2247

   这样写可能会好点,呵呵,试试看
    * * * * * . ~/.bash_profile;perl  connmysql.pl >> connmysql.log 2>&1 &

作者: 珞水的大叔   发布时间: 2010-10-10