Is it possible to spawn an application, send commands, expect results, but also 'respawn' the application in case it crashed and continue from the last point? I tried creating procedures for spawning, but I am not able to catch user shell prompt once the application gets closed
handling tcl expect application crash
692 Views Asked by meso_2600 At
1
There are 1 best solutions below
Related Questions in BASH
- How do I recursively find and replace only in files named index.php on Linux webserver?
- Delete the extra space after special character in all the lines of text file
- Calling a python function with options from shell script
- bc: prevent "divide by zero" runtime error on multiple operations
- Multiple commands with find and xargs, also accounting for special characters
- How to split a directory into parts without compressing or archiving?
- concat a lot of files to stdout
- Honoring quotes while reading shell arguments from a file
- No laravel sync folders in homestead vagrant on windows
- Grouping commands in curly braces and piping does not preserve variable
- SWI Prolog pass a goal with non-zero arity through the command line arguments
- Evaluating condition of if statement in awk using a second file
- How to customise bash completion to pick only a custom set of commands?
- Bash regular expression execution hangs on long expressions
- Bitwise OR in bash arguments with square brackets
Related Questions in UNIX
- passing text with \n as one argument in shell
- C std library don't appear to be linked in object file
- How to split a directory into parts without compressing or archiving?
- Momentjs get current GMT unix time
- Timing packets on a traffic server
- man pages for c variable types
- Blocking in pthread_join()
- PWX-00001 Error opening repository "dtlmsg.txt". RCs = 268/150/2
- Unix c program to calculate pi using threads
- How to perform parallel processes for different groups in a folder?
- Set aliases globally for all users
- wmic csproduct get UUID equivalent for Unix and Mac?
- Send alert for 80% threshold comparing two values from Disk partition
- Unix - Tail Utility would open the file or not
- Redirect Outward of unix os commands to html page
Related Questions in TCL
- Missing title bar when using wm manage and wm forget
- Questions on Regex algorithm (not necessarily EXPECT related)
- format in TCL in not working correctly
- Pick out certain lines from files
- Non-Greedy regex acts greedy based on the position of atoms in regex
- how to install Expect for windows using ActiveTCL 8.6 x86
- How to change link color in NS2?
- fconfigure refuses to set baud rate to 921600
- Search file by placement of element in a line
- Returning Some Variable from a "proc" in Tcl
- What is TCL's pattern for translating GUI actions to TCL statements
- Is the Tcl `file dirname` command usable for URL?
- synopsys dc_shell get_attribute number of digits
- Search for element after a designated string
- Using $variable in Parenthesis in Tcl (proc)
Related Questions in EXPECT
- Questions on Regex algorithm (not necessarily EXPECT related)
- Redirecting console output in python
- Expect Script through Putty works but not when called by scripts executed via http
- how to install Expect for windows using ActiveTCL 8.6 x86
- expect script regex not working
- Transmit commands via ssh with password using expect
- Expect script for checking ssh connection for a list of ips
- No Such Variable When Using While Loop in Expect
- Bash script truncates output files at 4096 bytes
- Expect script - while loop to validate user input and allow to re-enter while persisting session.
- autoexpect on docker centos6.6 container cannot work
- removing user interaction from java jsch
- Persistent non-interactive FTP session for usage in shell scripts
- Convert expect output from DOS to UNIX style in realtime
- ssh script to connect to server
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
So it sounds like you are doing something like telneting or sshing into a shell then running an application. The application dies or hangs so the prompt does not return so expect does not return and so you are stuck. You will need to use timeout to detect a hang and restart your entire process ( including the spawn). Below is the boiler plate I start with when writing expect scripts. The critical thing to help you resolve your problem is to realize that spawn not only sets the spawn_id but also returns the pid of the spawned process. You can use that pid to kill the spawned process if you get an eof and/or a timeout. My boiler plate kills the spawn process on timeout. The timeout does not bail from the expect loop but waits for the eof before exiting. it also accumulates the output of expect command so on timeout you may be able to see where it dies. The boilerplate is in a proc called run. Spawn the process and pass the pid and the spawn id . Reuse the boiler plate to define other procs that will be the steps. put the procs in a script with a counter between them as shown and repeat. The other answerer is correct that the unless the app restarts where you left off you can need to start from scratch. If it does start from where you left off. make the steps granular enough that you know what command to repeat. and step to start from. BoilerPlate