Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Program 1 runs irregularly, and crashes program 2, which then crashes program 1.

I'm not able to find the proper way to make program 2 stop when program 1 is initiated, and then restart program 2 when program one quits. I'm tired of having to manually do this, and I have been searching for a solution for the past few hours.


share|improve this question
up vote 1 down vote accepted

a combination of trap and exit in a wrapper script should help ....

like on encountering the process prog2 in ps -ef | grep prog2 , you can use exit in wrapper to send signal to trap - using trap you can specify what action to do like normal exit or force kill ie kill -9 PID_progX !!

wrapper is something like a controling script that will start , stop and monitor the process so that you dont have to start or stop them your self.

share|improve this answer
Nice. Thank you. – Eric Leroy May 22 '13 at 5:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.