Python Forum
Linux: Automatically kill process with fixed exe path - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Linux: Automatically kill process with fixed exe path (/thread-17738.html)



Linux: Automatically kill process with fixed exe path - anddontyoucomebacknomore - Apr-22-2019

When I use the ps command in termux on my android it displays a path corresponding to the processes (along with PID,PPID,etc). I believe this is the exe path of the process and it is this path that I'm refering to. I would like to know if there is a way to code a python program that automatically(and continuously) kills the processes that spawn with this exe. I have the pathlib installed in my QPython3.6 I thought about doing an infinite loop and parsing proc in search of the exe path. But I'm not sure if it would work or be fast enough to not slow the phone (the process I want to kill respawns instantly every time I kill it)


RE: Linux: Automatically kill process with fixed exe path - Pedroski55 - Apr-22-2019

Don't know if this will help at all, but in linux bash I call xkill. Kills anything stone dead, but you have to click the xkill mouse pointer mouse on the offending window!


RE: Linux: Automatically kill process with fixed exe path - anddontyoucomebacknomore - Apr-22-2019

thanks but I don't think the xkill command is avaliable for android


RE: Linux: Automatically kill process with fixed exe path - Gribouillis - Apr-22-2019

I would go with the psutil module, if it is available for android. This module can iterate through the running processes, give you all kind of informations about them and kill them if you want.


RE: Linux: Automatically kill process with fixed exe path - anddontyoucomebacknomore - Apr-22-2019

I'm having some trouble installing psutil module from pip.

"Connection to pypi.python.org" timed out and a mesage telling it could not find a version that satisfies the requirement psutil