in reply to Need Function for Timing out shell commands
I did this a while ago in Timing and timing out Unix commands.