Reputation: 307
I want to monitor the power that my system needs when I run a benchmark. When the benchmark ends the monitoring process should be killed. The monitor script is written in Python.
The script which starts the monitoring script must be a Bash-script because its should be started with the same script as the Benchmark. How do I do that?
Upvotes: 2
Views: 69
Reputation: 335
import os, sys
if "benchmark" not in os.popen('tasklist').read():
sys.exit()
Checks if a process "benchmark" is in the tasklist and if not closes the python script. Easiest answer I think.
Upvotes: 1