0

在刚刚安装了 IBM Infosphere 版本 8 的新 unix 服务器上运行 ksh 脚本时,我遇到了 SIGSEGV 错误。当 unix 脚本更新配置文件中的提取日期时间时,我收到错误消息。该脚本由 Datastage 序列调用。

脚本因以下问题中止:“程序“/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

请帮忙!

4

1 回答 1

0

该脚本由 Datastage 序列调用。脚本因以下问题而中止:

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

从上面,我了解到该脚本是从您的调用字符串定义的不同程序中调用的:"ksh shUpdate_Config.sh ... "

其工作方式是,您定义的任何外部命令(称为Datastage 序列)都由 unixsystem(string)库调用执行。这反过来又调用:

/bin/sh -c <string>

显然,该调用有问题,因为它不是ksh崩溃,而是/bin/sh.

首先要检查的是命令行"ksh shUpdate_Config.sh ..." 对于初学者,您的定义是否实际上包含双引号",或者您是否为本示例添加了这些?

于 2012-09-07T09:08:17.030 回答