CO - Kill does quite work

community
Steve L. Nyemba 7 years ago
parent 12ab751efd
commit b831586a97

@ -105,16 +105,18 @@ class Apps(Actor) :
items = self.ng.search(name)[0] items = self.ng.search(name)[0]
app = items[0] app = items[0]
args = self.config[app] args = self.config[app]
cmd = " ".join([app,args])
cmd = " ".join([app,args,"&"])
self.execute([app,args]) self.execute([app,args])
print [app,args]
def kill(self,name) : def kill(self,name) :
""" """
kill processes given the name, The function will not be case sensitive and partial names are accepted 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 @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']) args = "".join(["ps -eo pid,command|grep -E -i ",name.lower(),'|grep -E "^ {0,}[0-9]+" -o -m 1|xargs kill -9'])
self.execute(["ps",[args] ]) self.execute([args ])
print args print args
def analyze(self,logs) : def analyze(self,logs) :
""" """
@ -415,7 +417,7 @@ 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"} conf = {"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome":"https://the-phi.com"}
a = Actor.instance('Apps',conf) a = Actor.instance('Apps',conf)
if __name__ == '__main__': if __name__ == '__main__':
thread = Orchestrator() thread = Orchestrator()

Loading…
Cancel
Save