Folks,
In shell script, can I mention a timeout for a command execution, afterwhich I want to exit from that particular line and proceed furthur.
I have part of my script as below:
******************************
cd $EXPECT_HOME
expect custom_install.exp mv $QA_HOME/install_run/logs/task*.xml $QA_HOME/install_run/logs/console
.....and so on...
********************************
Problem I am cing is, its hanging at the end of Expect script execution..
I just wanna comeout of that after say 2 mins and proceed.
(Expect time out in expect script doesnt work for me somehow).
So, from shell script, can I handle it somehow?
spawn a child process which captures it's pid
spawns another child process which does sleep followed by kill of that pid
set up a trap handler
spawn another child process to exec the command capturing the pid of that process
wait for the exec child to finish
clear that pid variable
in the trap handler, if the pid variable is still set then kill that pid
if the killer child has not finished, kill it
Show us your expect script. Looks like you may not coded it to
include timeouts or EOF situations Expect can hang on timeout
if waiting for a particular pattern but receives EOF instead.