[oracle@tdsogg tmp]$ crontab -l
*/5 * * * * sh /tmp/delete.sh
*/5 * * * * /tmp/delete.sh
5 * * * * sh /tmp/delete.sh
5 * * * * /tmp/delete.sh
05 * * * * sh /tmp/delete.sh
05 * * * * /tmp/delete.sh
5 * * * * /tmp/delete.sh
5 * * * * sh /tmp/delete.sh
[oracle@tdsogg tmp]$ ls /tmp/delete.sh
/tmp/delete.sh
[oracle@tdsogg tmp]$ cat /tmp/delete.sh
#!/bin/bash
DELETE_SCRIPT=/tmp/delete_script.sql
GET_DELETE_SQL=/tmp/get_delete_sql.sql
export DELETE_SCRIPT
export GET_DELETE_SQL
rm -rf "$DELETE_SCRIPT"
export ORACLE_SID=tdsogg
sqlplus " / as sysdba" @$GET_DELETE_SQL
chmod 775 $DELETE_SCRIPT
RMAN_LOG_FILE=/tmp/delete_log_`date +%Y%m%d_%H%M%S`.out
rman target / nocatalog msglog $RMAN_LOG_FILE @$DELETE_SCRIPT
查看日志也没有收获
而手工 sh delete.sh 却可以运行
应该是环境变量引起的
cat .bash_profile
将
PATH=$PATH:$HOME/bin
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
加到delete.sh 代码中,后运行正常
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。