- Code: Select all
p = subprocess.Popen("ps -ef | grep programToFind | grep -v grep ",shell=True,stdout=subprocess.PIPE, stderr = subprocess.PIPE)
ppp= p.communicate()[0].strip("\n").split("\n")
p.stdout.close()
p.stderr.close()
p.wait()
then use PPP to check if process programToFind is running and either restart or ...
After some days I find the mac running at 100% and there are many "grep" process consuming all the cpu. This is a basic call I have been using for some time.
I believe, I am closing the subprocess.Popen correctly.
nothing special in the system log file and nothing in the indigo log file
.. any advice from THE experts?
Karl