Skip to main content

Find (and kill) long running processes by name and arguments

Project description

dieyoung

Find / kill very long running processes by name, args and age

Installation

recommended way: pipx install dieyoung

or (better if inside python virtualenv): pip install dieyoung your system may have pip3 instead of pip.

Find processes by name / arguments, three different modes

See all my ssh sessions:

$ dieyoung ssh
732333 8h ssh alv
742297 7h ssh jul
745335 6h ssh mx
875490 38m ssh -i /home/xenon/.ssh/id_ed25519 mx
880910 25m ssh mx -i /home/xenon/.ssh/id_ed25519

Format is simple: pid, age, cmdline

Now, lets suppose we want to find only ssh to mx:

$ dieyoung ssh mx
745335 6h ssh mx
875490 39m ssh -i /home/xenon/.ssh/id_ed25519 mx
880910 25m ssh mx -i /home/xenon/.ssh/id_ed25519

Three sessions are found, because each of them has "ssh" and "mx" in cmdline (in any order). This is how --mode any works (default mode), processes matches our pattern if all words from pattern are found anywhere in process cmdline, even if there are other arguments.

--mode start: First words of cmdline must match pattern, e.g.

$ dieyoung -m start -- ssh -i 
875490 39m ssh -i /home/xenon/.ssh/id_ed25519 mx

But this filter will not find process ssh mx -i /home/xenon/.ssh/id_ed25519 (because ssh mx is not ssh -i). Note, we used -- to separate PATTERN (ssh -i) from dieyoung arguments.

--mode full: process cmdline must fully match pattern, e.g.

$ dieyoung -m full -- ssh -i /home/xenon/.ssh/id_ed25519 mx
875490 40m ssh -i /home/xenon/.ssh/id_ed25519 mx

Filter by age, user and executable

To find processes older then some age use -a / --age option, like -a 1h30m (to find processes older then 1 hour and 30minutes)

--exe PATH to find only processes with this executable, e.g. if you want to find /usr/bin/php but not /opt/php/7.4/bin/php.

--user USERNAME to find only processes of this user.

Kill / Terminate processes

After you found processes, you may kill it manually with kill command, or use built-in feature. Add --terminate option to gracefully send SIGTERM to each matching process or --kill to send SIGKILL (like kill -9 <pid>).

Inspect more details of processes

Add -j / --json to show more info about processes

Foolproof protection (--notmore)

If --kill or --terminate given, dieyoung will count number of matching processes and refuse if it has to kill more then --notmore N. Default value is 1.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dieyoung-0.0.6.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dieyoung-0.0.6-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file dieyoung-0.0.6.tar.gz.

File metadata

  • Download URL: dieyoung-0.0.6.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for dieyoung-0.0.6.tar.gz
Algorithm Hash digest
SHA256 c1eb50cacf81267791b146c77dd3ce6957f38e56e4a41b74e42a696e908bd06a
MD5 2fd2a41a221e88856908140f5e002ba5
BLAKE2b-256 15b10ac9ea8da120120d2a258c3e7018022dde1e185f038eaa51b7c22d7446fa

See more details on using hashes here.

File details

Details for the file dieyoung-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: dieyoung-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for dieyoung-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b58bee1b7cf47a933461a8611fab7875234bfd952dfb2a2fa3da43777075f5d9
MD5 9aecbb5a7db2f95be132698688b2f6bd
BLAKE2b-256 6f77c7ae2cbe975a59bd065c5a1198f76f5a98536b5f298cfa52218f7ef8de36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page