I have a .ksh script does a system call as follows.
recoveryProgram auto > /dev/null
MYRESULT=$?
if [ $MYRESULT != "0" ] ; then
# If 'recovery' failed
releaseBrokenStation $SYSTEM
emailFailure
fi
Sometimes, this system call (recoveryProgram auto) gets hung. I would like to be able to have a time out, lets say about 60 minutes and if the system call doesnt finish, I would like to kill the system call (and all other child process this system call may have created). That way, my script can move on to the next step. However, I also need to know if the system call got hung.
Please note that this needs to run on Linux (Ubuntu) as well as on HPUX 11.27. Can someone please tell me what would be the best way to do this?