I have an application written in Qt that runs on Ubuntu, let's call that application Foo. Foo runs the following script once around once a minute:
./x & # Run this program in the background
childPid=$!
pkill -x "Foo"
./Foo &
sleep 5
pkill $childPid
This works as expected for the first 14 or 15 "generations" - it runs the x program, closes my Foo program, relaunches my Foo program, and then kills the x program. But, on the 14 or 15th generation/cycle/what have you - the x program keeps running and as far as I can tell, never dies again after that.
I know it's madness, but I more or less have to do it this way (at least, I need to run x, close foo, relaunch foo, close x every n seconds, if there is a better way to accomplish that I am all ears!)
If anyone has any idea at all what could be causing this, I would greatly appreciate the insight. Thank you!