Python Forum
Linux: Automatically kill process with fixed exe path
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linux: Automatically kill process with fixed exe path
#1
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)
Reply
#2
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!
Reply
#3
thanks but I don't think the xkill command is avaliable for android
Reply
#4
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.
Reply
#5
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  kill python execution program lebossejames 0 184 Mar-16-2024, 11:16 AM
Last Post: lebossejames
  How to do "fixed size" (wrapping) math in Python? AlexanderWulf 13 1,733 Jul-19-2023, 04:13 PM
Last Post: deanhystad
  Fixed colum width for rowLabels i Matplotlib pandabay 0 400 Jun-10-2023, 03:40 PM
Last Post: pandabay
  Encrypt and decrypt in python using own fixed key SriRajesh 3 4,626 Feb-20-2022, 01:18 PM
Last Post: dboxall123
  How to immediately kill and restart a thread while using a time.sleep() inside it? philipbergwerf 4 3,452 Feb-07-2022, 04:16 PM
Last Post: Gribouillis
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 2,150 Sep-09-2021, 01:25 PM
Last Post: Yoriz
  Play fixed frequency sound in python 3 jpezz 2 2,724 Feb-07-2021, 08:21 PM
Last Post: jpezz
  Referencing a fixed cell Mark17 2 2,020 Dec-17-2020, 07:14 PM
Last Post: Mark17
  Using a button to kill and restart a script duckredbeard 3 3,247 Sep-01-2020, 12:53 AM
Last Post: duckredbeard
  how to check for thread kill flag nanok66 1 2,150 May-09-2020, 10:06 PM
Last Post: nanok66

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020