Script exit

HI,

I written a shell script to stop my peoplesoft applications.Peoplesoft provides a psadmin utility to stop the application. I used the force shutdown option with it psadmin -c shutdown! -d pskri. When my application process hungs in the background the script is not able to continue and getting hung. I have to manually use crl+c to come out. Is there anyway i can force the shell script to come out if it is failed failed to stop the process...Is there any exit codes i can specify?

You can send a kill -INTR <pid> where pid=process id of your session.

JIm,

This is a manual process when the script runs..I want to do it automatically inside the script itself. Is it possible?

For eg. May be a timeframe i can use.if the script exceeds the timeline kill or something..or if the script struck in some part come out with some exit code..Hope you got my requiement..

Thank You.

Have you tried to write a function for it !!

for instance: after the code that you have wrote you can check its return value by
echo $?
if the output was zero, so the command has executed properly,
if output was 1 thats mean the command didnt work properly

try to write if for it, like

if ((echo $?==0 ))
then
break;
fi

I hope to be what you are looking for