ammu
January 16, 2009, 3:39pm
1
hi,
I have an unix script and i'm executing from command prompt in windows.
The script is exiting immediately when i call the script.But the script is getting executed at the back end.
But when i type sh at command prompt i'm getting $ sign and i can see the execution of script.
Is there any way to modify my script to wait until completion of the process and then exit.
Also is there any problem when trying to call d:\script\a.ksh from C:\
Please advice!
joeyg
January 16, 2009, 4:03pm
2
you could add the following line to your unix script
echo "press enter to continue"; read ans
Which would cause the script to wait until your press the ENTER key.
ammu
January 16, 2009, 4:17pm
3
Is there any other method instead of manually entering the key. This script is used for scheduling purpose.
ammu
January 20, 2009, 10:09am
4
Any ideas about doing this. Please advice!
Unless we see your script and what it is doing, we really cannot help you. You simply have not provided enough information.
ammu
January 20, 2009, 12:04pm
6
Hi,
This is my script.
#!/usr/bin/sh
PROG=`basename ${0}`
EXIT_STATUS=0
NOW=`date`
echo "${NOW} ${PROG} Initialization..."
DSHOME=C:/IBM/InformationServer/Server/DSEngine
FILE_NAME=`basename $0 .ksh`
DSPROJNAME=PROJ_DEV
DSJOBNAME=`basename $0 .ksh`
BinFileDirectory=$DSHOME/bin
DSLOG="DS_"$DSJOBNAME
DSLOG_FILE=C:/projects/log/$DSLOG.log
DT_START=`date`
echo "-----------------------------------------">>$DSLOG_FILE
echo "${NOW} ${PROG} : Execution Started at for Datastage Job Sequencer:" $DSJOBNAME " on date:$DT_START">>$DSLOG_FILE
################################################################################
# Execute job here
################################################################################
echo "${NOW} ${PROG} : ${BinFileDirectory}/dsjob.exe -user user1 -password password -server server -run -jobstatus -wait $ParamList $DSPROJNAME $DSJOBNAME" >> $DSLOG_FILE
RETURN_VALUE=$?
case $RETURN_VALUE in
1|2)
echo "${NOW} ${PROG} : Job $DSJOBNAME completed successfully " >>$DSLOG_FILE
EXIT_STATUS=0
;;
0)
echo "${NOW} ${PROG} : Error: $DSJOBNAME job failed. error code was -ALREADY RUNNING- Code $RETURN_VALUE" >> $DSLOG_FILE
EXIT_STATUS=99
;;
3|96)
echo "${NOW} ${PROG} : Error: $DSJOBNAME job failed. error code was -ABORT- Code $RETURN_VALUE" >> $DSLOG_FILE
EXIT_STATUS=$RETURN_VALUE
;;
8|13)
echo "${NOW} ${PROG} : Error: $DSJOBNAME job failed. error code was -Failed Validation- Code $RETURN_VALUE" >> $DSLOG_FILE
EXIT_STATUS=$RETURN_VALUE
;;
97)
echo "${NOW} ${PROG} : Error: $DSJOBNAME job failed. error code was -Stopped- Code $RETURN_VALUE" >> $DSLOG_FILE
EXIT_STATUS=$RETURN_VALUE
;;
9)
echo "${NOW} ${PROG} : Error: $DSJOBNAME job failed. error code was -Not Compiled- Code $RETURN_VALUE" >> $DSLOG_FILE
EXIT_STATUS=$RETURN_VALUE
;;
*)
echo "${NOW} ${PROG} : Error: $DSJOBNAME job failed. error code was $RETURN_VALUE" >> $DSLOG_FILE
EXIT_STATUS=$RETURN_VALUE
;;
esac
if [ ${EXIT_STATUS} -ne 0 ]
then
echo "${NOW} ${PROG} : Error in the Shell for calling the Datastage job sequencer:" $DSJOBNAME >>$DSLOG_FILE
else
echo "${NOW} ${PROG} : Successfully executed the Shell for calling the Datastage job sequencer:" $DSJOBNAME >>$DSLOG_FILE
fi
DT_END=`date`
echo "${NOW} ${PROG} : Execution Ended on $DT_END with Shell Status as :"$EXIT_STATUS>>$DSLOG_FILE
echo "--------------------------------------------">>$DSLOG_FILE
exit ${EXIT_STATUS}
Thanks!