重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

crontab不运行

[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不运行
URL地址:http://cqcxhl.cn/article/gscdss.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP