I have a command CMD called from my main bourne shell script that takes forever.
I want to modify the script as follows:
- Run the command CMD in parallel as a background process (
CMD &). - In the main script, have a loop to monitor the spawned command every few seconds. The loop also echoes some messages to stdout indicating progress of the script.
- Exit the loop when the spawned command terminates.
- Capture and report the exit code of the spawned process.
Can someone give me pointers to accomplish this?