2012-09-04 23 views
0

在刚刚安装IBM Infosphere版本8的新unix服务器中运行ksh脚本时,我正面临SIGSEGV错误。 我在unix脚本更新配置文件中的提取日期时出现错误。该脚本由Datastage序列调用。来自unix ksh脚本的分段错误

该脚本中止问题: “Program”/ bin/sh“已终止。[SIGSEGV]分段违例”。

该问题的网络搜索表示问题是由无效的内存引用引起的。

下面提到的是执行脚本的命令。

"ksh shUpdate_Config.sh MEARS MSDS_MP_ATTRIBUTES_BS_VW /data/projects/scver_etl/EXTRACTS_pub/configurationfiles/MEARS.MSDS_MP_ATTRIBUTES_BS_VW.Lastupdseqno.dat /data/projects/scver_etl/EXTRACTS_pub/configurationfiles/ '2012-08-08 12:35:24'" 

这里是脚本的内容 -

#!/bin/ksh 
    ######################################################################### 
    #Script Name:-shUpdate_Config.sh 
    # 
    #Script Description:- The script updates the STATUS_TABLE with the Extraction Date time and updates the sequence number by 1. 
    # 
    #Created By:- Vineet 
    # 
    #Job History:- 
    # 
    #Sl No   Version   Modification Date   Modified by    Modification Desc 
    #01.   Initial    11/04/2012     Vineet     Initial Version 
     ######################################################################################################################################### 

if [ $# -ne 5 ] 
then 
    print "Incorrect number of parameters passed, Quiting ..." 
    exit 1 
fi 
# Enter the Source Id From the user 
srcid=$1 
# Enter the source table name by user 
tabnme=$2 
# Enter the Status File Name from User 
filename=$3 
#Enter the Temp file Path from User 
file_path=$4 
#Enter the Server time to be updated 
Server_datetime=$5 
if [ ! -f $filename ] 
then 
    print "Configuration File not present at the required path, Quiting ..." 
    exit 1 
fi 

grep $srcid $filename >> /dev/null 

if [ $? -ne 0 ] 
then 

    print "Source system name not found in configuration file, Quiting ..." 
    exit 1 
fi 

grep $tabnme $filename >> /dev/null 

if [ $? -ne 0 ] 
then 

    print "Source view name not found in configuration file, Quiting ..." 
    exit 1 
fi 

while [ 1 ] 
do 
    if [ -f $filename.lock ] 
    then 
      sleep 60 
    else 
      break 
    fi 
done 
touch $filename.lock 

DT=`echo $Server_datetime|cut -c1-10` 
TM=`echo $Server_datetime|cut -c12-19` 


awk '{FS="|";OFS="|"};{a=$3;b=$4;if ($1=="'$srcid'"&& $2=="'$tabnme'") {$3=a+1;$4="'$DT'"" ""'$TM'"} else{}{print $0}}' $filename > $file_path$srcid.$tabnme.tmp 

if [ $? -ne 0 ] 

then 
    print "Process failed, Quiting ..." 
    /bin/rm $filename.lock 
    exit 1 
fi 

#fi 
mv $file_path$srcid.$tabnme.tmp $filename 

if [ $? -ne 0 ] 

then 
    print "Process failed, Quiting ..." 
    /bin/rm $filename.lock 
    exit 1 
fi 

/bin/rm $filename.lock 

if [ $? -ne 0 ] 

then 
    print "Process failed, Quiting ..." 
    exit 1  
fi 
exit 0 

下面是该文件的内容(MEARS MSDS_MP_EVENTS_BS_VW Lastupdseqno),我们正在努力更新 -

Source_sys_name|Source_tbl_name|Seq_No|Extraction_date|Extraction_Mode 
MEARS|MSDS_MP_EVENTS_BS_VW|37|2012-08-08 11:51:19|D 

请帮助!

+0

当你运行/ bin/ksh时,它真的说“/ bin/sh terminated”吗?它死在哪里('ksh -x script ....'显示为最后几行)? – twalberg

回答

0

该脚本由Datastage序列调用。

"Program "/bin/sh" terminated. [SIGSEGV] segmentation violation". 

从上面的,据我所知,脚本是从不同的程序 叫你调用字符串定义:"ksh shUpdate_Config.sh ... "

这种工作方式是 脚本与发行中止您定义的任何外部命令(您称为Datastage序列)都会由unix system(string)库调用执行。这反过来又调用:

/bin/sh -c <string> 

显然,什么是错与调用,因为它不是ksh的崩溃,但/bin/sh

检查将是命令行"ksh shUpdate_Config.sh ..."对于初学者的第一件事,贵定义实际上包括双引号",还是你添加的这个例子?