crontab 定时sqlplus 报错(command not found)
项目场景:
centos7环境执行shell脚本
问题描述
单独执行shell脚本没有问题, crontab 定时执行报错 command not found
报错脚本 :
#!/bin/bash
sqlplus userid/password@TNS_NAME <<!
select * from tab;
exit;
原因分析:
报错信息如下 :
1, sqlplus :command not found
错误的原因,是系统找不到环境变量。
解决方案:
修改后的脚本是 :
#!/bin/bash
source /home/oracle/.bash_profile
sqlplus userid/password@TNS_NAME <<!
select * from tab;
exit;
总结
如果此篇文章有帮助到您, 希望打大佬们能
关注
、点赞
、收藏
、评论
支持一波,非常感谢大家!
如果有不对的地方请指正!!
参考1
还没有评论,来说两句吧...