troubleshooting Question

Howto find exit status of child process

Avatar of vinod
vinodFlag for United States of America asked on
11 Comments1 Solution1667 ViewsLast Modified:
In a bash script running in a cron job on my Linux box, I fork a child process to test something. The child process may exit with exit status of 0 or 1 within one second, or may hang waiting for something else. If it hangs, I simply kill it after a timeout of 5 secs. If it exits I need to know the exit status. How can I get exit status of the child process? Normally I could sync the parent to the child with "wait $child_pid" but I can't because of possibility of hang.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 11 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros