crontab和手动运行脚本之间的结果不同

时间:2019-08-13 13:27:52

标签: shell

Crontab为sqlplus现金运行。我有两个txt文件,并将txt文件转换为数组,当我手动运行它时它可以正常工作,但是在crontab中工作时,它仅占用数组的最后一个元素。(当我手动运行它时,它获取最后一个值。 ) Manually_output crontab_output

while read array[B]
do
((B=B+1))
done < /app/scripts/nw.txt
max=B
B=0
while read array2[A]
do
((A=A+1))
done < /app/SSG_HOME/scripts/nw2.txt
B=0
A=0
    while (( B < max ))
do
/app/instantclient_18_3/sqlplus -L **/**@**:**/** <<EOF
set embedded on
set pagesize 0
set linesize 256
set colsep ,
set trimspool on
set echo off
set feedback on
set termout off
set UNDERLINE off
set heading off
spool output.txt;
SELECT DESCRIPTION FROM ERROR_CODE where NETWORK_ERROR='${array[B]}' and 
SSGW_ERROR='${array2[A]}';
spool off;
more output.txt | grep -v rows | grep -v row | grep -v SELECT | grep -v 
SQL >> /app/scripts/nw3.txt 
EOF     
((A=A+1))
((B=B+1))
done

0 个答案:

没有答案