(Created page with "while True: found = False time.sleep(5) pids = [pid for pid in os.listdir('/proc') if pid.isdigit()] for pid in pids: try: cmd = open(os.path.join('/proc',...")
(No difference)
Latest revision as of 16:58, 29 December 2016
while True:
found = False
time.sleep(5)
pids = [pid for pid in os.listdir('/proc') if pid.isdigit()]
for pid in pids:
try:
cmd = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
if "gimx" in cmd:
found = True
except IOError: # proc has already terminated
continue
if found == True:
GPIO.output(led, True)
else:
GPIO.output(led, False)