i have one function block in the beginning of my script and there are some commands inside that function which will perform some operations.
And i am invoking that function from my main script by passing some values. Sometimes it is hanging in the middle for some value.
For example:
For 1st value (one) it is giving the output.
For 2nd value (two) it is hanging to retrieve the result due to server hang/connectivity issue. It hangs and not coming out and not processing the next value (three).
In this situation, i want the script to echo some value (ex: echo HANGING) and proceed with the next value (three) if the current process hangs (i.e, two) after trying for some specified minutes (ex: 2 mins).
i.e, if the func() is not given the o/p with in 2 mins it should echo HANGING. Please help me on this.
fun()
{
example: tnsping $i
....
....
....
}
for i in one two three
do
check=`fun@i`
echo $check >> test
done