[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 代码中,后运行正常
网站题目:crontab不运行
文章位置:
http://kswsj.cn/article/gscdss.html