当前位置: 技术问答>linux和unix
crontab 设置后的SH 执行错误.
来源: 互联网 发布时间:2016-04-06
本文导语: 查看CRONTAB 中的备份SH,看到运行日志中有错误. 但不知什么原因,为什么提示: /bin/sh: oracle: command not found 而 SH 是没有问题的. 以下有相关涉及到的资源,请各位帮忙看看是什么原因. ---oracle cron ------------------------------------...
查看CRONTAB 中的备份SH,看到运行日志中有错误.
但不知什么原因,为什么提示: /bin/sh: oracle: command not found
而 SH 是没有问题的.
以下有相关涉及到的资源,请各位帮忙看看是什么原因.
---oracle cron --------------------------------------
crontab -l
23 * * * oracle /home/oracle/scripts/exp_daily.sh
-----------------exp_daily.sh-----------------------
#!/bin/bash
# set environment variable
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/9.2.0
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
#export NLS_LANG=AMERICAN_AMERICA.UTF8
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
##modiby by tang miya 2008/07/14
DUMPFILE1=/u01/backup/chnmy$(date "+%Y%m%d").dmp
DUMPFILE2=/u01/backup/trip$(date "+%Y%m%d").dmp
DUMPFILE3=/u01/backup/payee$(date "+%Y%m%d").dmp
cd /u01/backup
exec >> exp_chnmy$(date "+%Y%m%d").log
echo
echo "*******************************************************"
echo "* Exporting database at `date`"
echo "*******************************************************"
echo
#export dmp file.
# zip dmp file.
exp system/syspass owner=chnmy file=$DUMPFILE1 log=exp_chnmy$(date "+%Y%m%d").log
compress -f $DUMPFILE1
------/var/spool/mail/oracle9--------------------------------------------
Subject: Cron oracle /home/oracle/scripts/exp_daily.sh
X-Cron-Env:
X-Cron-Env:
X-Cron-Env:
X-Cron-Env:
/bin/sh: oracle: command not found
----------------------------------------------------------------------------
[oracle@crm bin]$ ll *sh*
-rwxr-xr-x 1 root root 94364 Jun 25 2001 ash
-rwxr-xr-x 1 root root 472492 Jun 25 2001 ash.static
-rwxr-xr-x 1 root root 520140 Jun 28 2004 bash
lrwxrwxrwx 1 root root 4 Aug 19 2006 bash2 -> bash
lrwxrwxrwx 1 root root 3 Aug 19 2006 bsh -> ash
lrwxrwxrwx 1 root root 4 Aug 19 2006 csh -> tcsh
-rwxr-xr-x 1 root root 200469 Jun 3 2003 ksh
lrwxrwxrwx 1 root root 4 Aug 19 2006 sh -> bash
|
>>crontab -l
>> 23 * * * oracle /home/oracle/scripts/exp_daily.sh
修改如下:
0 23 * * * /home/oracle/scripts/exp_daily.sh
>> 23 * * * oracle /home/oracle/scripts/exp_daily.sh
修改如下:
0 23 * * * /home/oracle/scripts/exp_daily.sh