I would want to run a code for 1 min and if it doesnt succeed in 1 min..I would want to exit it..I am using the following code...But the script is not going into my code part.It is waiting for 60 secs and then getting killed.
The code which is in the while loop actually takes less than 60 secs...
Could someone look into the below code
echo $$ > myprog.lck
echo sleep 60 > mytmp.sh
echo kill -9 \`cat myprog.lck\` >> mytmp.sh
sh mytmp.sh &
while true;
do
code
done
exit 1
Heyy Thanks again...In my original code if I would want to exit the mytmp.sh when my inner code runs within the time ie I dont want the mytmp.sh to run for the entire 1 minute if my inner code gets executed in 30 secs.Any help on this front