Need help in script
Posted: Tue Feb 24, 2009 1:24 pm
Hi Everyone,
I have two jobs A and B . B should be execute after A finsihes and the job B will create a dummy file on unix server. I created a sequence job C which has A-->B .I have a requirement to
1) execute the sequence job C .
2)Interrogate for the existence of dummy file.
3)If the file doesnot exist, sleep for 5 minutes and loop back to step 1
4) If the file exists or if the number of loop exceed 5, exit out of the loop.
For this iam trying to write a unix script. Could anyone help me with the following script
#! /usr/bin/ksh
DataStage_BIN_DIR="/opt/IBM/InformationServer/Server/DSEngine/bin"
PROJECT="$1"
JOBNAME="$2"
FILENAME="/opt/etl/Projects/xxx/xxx/dummy.txt"
for L in 1 2 4 5
do
${DataStage_BIN_DIR}/dsjob -run ${PROJECT} ${JOBNAME}
STATUS=$?
if [ $STATUS -ne 0 ]
then
echo "*** DataStage error! status = $STATUS"
exit 2
fi
A="`cat $FILENAME`"
echo $A
if [ "$A" == "1" ]
then
return 0
fi
sleep 300
done
exit 1
Let me know any changes have to be made in the script , since when i tried to execute the script with command activity stage its throwing a warning script didnot finish.. It would be helpful if any one can share a sample script to solve this requirement..
Thanks in Advance
I have two jobs A and B . B should be execute after A finsihes and the job B will create a dummy file on unix server. I created a sequence job C which has A-->B .I have a requirement to
1) execute the sequence job C .
2)Interrogate for the existence of dummy file.
3)If the file doesnot exist, sleep for 5 minutes and loop back to step 1
4) If the file exists or if the number of loop exceed 5, exit out of the loop.
For this iam trying to write a unix script. Could anyone help me with the following script
#! /usr/bin/ksh
DataStage_BIN_DIR="/opt/IBM/InformationServer/Server/DSEngine/bin"
PROJECT="$1"
JOBNAME="$2"
FILENAME="/opt/etl/Projects/xxx/xxx/dummy.txt"
for L in 1 2 4 5
do
${DataStage_BIN_DIR}/dsjob -run ${PROJECT} ${JOBNAME}
STATUS=$?
if [ $STATUS -ne 0 ]
then
echo "*** DataStage error! status = $STATUS"
exit 2
fi
A="`cat $FILENAME`"
echo $A
if [ "$A" == "1" ]
then
return 0
fi
sleep 300
done
exit 1
Let me know any changes have to be made in the script , since when i tried to execute the script with command activity stage its throwing a warning script didnot finish.. It would be helpful if any one can share a sample script to solve this requirement..
Thanks in Advance