Python Forum

Full Version: Linux: Automatically kill process with fixed exe path
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
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!
thanks but I don't think the xkill command is avaliable for android
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.
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