CO - application killing

community
Steve L. Nyemba 7 years ago
parent 2a3a0fcb96
commit 793cb78cf0

@ -109,8 +109,13 @@ class Apps(Actor) :
self.execute([app,args]) self.execute([app,args])
def kill(self,name) : def kill(self,name) :
args = "".join(["-eo pid,command|grep -Ei ",name.lower(),'|grep -E "^ {0,1}[0-9]+" -o|xargs kill -9']) """
self.execute(["ps",args]) kill processes given the name, The function will not be case sensitive and partial names are accepted
@NOTE: Make sure the reference to the app is not ambiguous
"""
args = "".join(["-eo pid,command|grep -E -i ",name.lower(),'|grep -E "^ {0,}[0-9]+" -o|xargs kill -9'])
self.execute(["ps",[args] ])
print args
def analyze(self,logs) : def analyze(self,logs) :
""" """
This function is designed to analyze a few logs and take appropriate action This function is designed to analyze a few logs and take appropriate action
@ -410,7 +415,9 @@ class Orchestrator(Actor):
# class Alert(Actor): # class Alert(Actor):
# def process(self,item): # def process(self,item):
# pass # pass
conf = {"/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome":"https://the-phi.com"}
a = Actor.instance('Apps',conf)
if __name__ == '__main__': if __name__ == '__main__':
thread = Orchestrator() thread = Orchestrator()
thread.start() thread.start()

Loading…
Cancel
Save