mcpField
P
process-cleanup

process-cleanup

github.com/paulrbergCloud & DevOps10278 installsUpdated today
Repository

About process-cleanup

process-cleanup is an agent skill for detecting zombie processes with `/bin/ps` and optionally prompting their parents to reap them. It defaults to detection-only and requires user confirmation before killing a parent that ignores `SIGCHLD`.

Key features

  1. 01Detect zombies using `/bin/ps`
  2. 02List process state and parent IDs
  3. 03Default to detection-only mode
  4. 04Send `SIGCHLD` with `--kill`
  5. 05Require confirmation before killing a parent

Use cases

  1. 01Inspect a host for zombie processes
  2. 02Request that parent processes reap exited children
  3. 03Identify parent PIDs when zombies remain

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/paulrberg/agent-skills --skill process-cleanup

After installing, type/process-cleanupin Claude Code to confirm it loaded.

Bundled filesscripts/kill-zombies.sh

Details

From the project README

Process Cleanup

Detect and reap zombie processes using /bin/ps.

Background

A zombie (state Z) is a process that has exited but whose parent hasn't called wait() to collect its exit status. Zombies consume no CPU or memory, but they hold a PID slot and can accumulate. You can't kill a zombie — it's already dead. The only remedies are:

  1. Signal the parent with SIGCHLD so it reaps the child
  2. Kill the parent so init/launchd adopts and reaps the orphan

Important: use ps for process state queries

Always use ps (BSD) for process state queries. If ps is aliased, use /bin/ps to bypass it.

# List zombies
/bin/ps ax -o pid,state,ppid,user,command | awk '$2 ~ /Z/'

# List all processes with state
/bin/ps ax -o pid,state,ppid,etime,args

Usage

Run the helper script to scan for zombies:

# Detect only (default) — list zombie processes
bash scripts/kill-zombies.sh

# Reap zombies — send SIGCHLD to parent processes
bash scripts/kill-zombies.sh --kill

Safety

  • Default mode is detect-only — no processes are signaled
  • With --kill, the script sends SIGCHLD to parent processes (non-destructive nudge to reap)
  • If a parent ignores SIGCHLD, the script reports the parent PID — confirm with the user before killing it
  • Never kill PID 1 (init/launchd)

Comments

Markdown supported