4 # wait for a pid with given timeout
5 # returns 1 if it timed out, 0 if the process exited itself
8 timeout=$2 # in seconds
10 while kill -0 $pid 2> /dev/null; do
12 _wcount=`expr $_wcount + 1`
13 if [ $_wcount -eq $timeout ]; then
20 if `waitforpid $1 $2`; then
21 echo "process $1 exited"
23 echo "process $1 timed out"