-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathchecker.py
More file actions
35 lines (30 loc) · 885 Bytes
/
checker.py
File metadata and controls
35 lines (30 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import subprocess
import os
import telegram_send
import time
def check_process(name):
output = []
cmd = "ps -aef | grep -i '%s' | grep -v 'grep' | awk '{ print $2 }' > /tmp/out"
os.system(cmd % name)
with open('/tmp/out', 'r') as f:
line = f.readline()
while line:
output.append(line.strip())
line = f.readline()
if line.strip():
output.append(line.strip())
return output
while(1):
p = ["chrome", "Firefox", "Safari"]
lenght = len(p)
for i in range(lenght):
c = check_process(p[i])
print(c)
a=[]
if c <= a:
print("no bueno"' '+p[i])
telegram_send.send(messages=["no bueno"' '+p[i]])
else:
print("is running"' '+p[i])
telegram_send.send(messages=["is running"' '+p[i]])
time.sleep(36)