[root@aixsrv]/root# cat test_timeout.sh #!/bin/ksh93 DURATION="1200" # 20 minutes timeout() { # to=$1; shift $@ & wp=$! start=0 while kill -0 $wp; do read -t 1 start=$((start+1)) if [ $start -ge $DURATION ]; then kill -9 $wp && echo "Process killed after $DURATION seconds" && break fi done } timeout $@