在剛剛安裝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
請幫助!
當你運行/ bin/ksh時,它真的說「/ bin/sh terminated」嗎?它死在哪裏('ksh -x script ....'顯示爲最後幾行)? – twalberg