Bash public

Zombie Process Finder

Share this script safely, inspect its metadata, and copy the exact command you need.

Dashboard

Ready to run

One-liner

Copy the command, then review before execution.
curl -fsSL https://runny.sh/r/5CCN57M56WR5 | bash

Current version: 1.1 · Updated by Godmode · 2026-09-07 02:38:59.245

At a glance

Script metadata

Slug
5CCN57M56WR5
Fetches
0
Size
1233 B · 50 lines
Expires
never
Last fetch
Created
2026-09-07 00:35:59.465
Description
Processes stuck in the Z state

Readable before runnable

Preview

#!/usr/bin/env bash
# Zombie process finder
# Read-only: lists processes in Z state. Warns if any exist, critical at 10 or more.
# Exit 0 if healthy, 1 if warning, 2 if critical or ps is missing.
# Hosted on Runny.sh. Review the script page before you run it.

set -u

status=0
note() { printf '%s\n' "$*"; }
bump() {
  case $1 in
    crit) status=2 ;;
    warn) [ "$status" -lt 1 ] && status=1 ;;
  esac
}

note "=== Zombie processes ==="
note "Host:     $(hostname 2>/dev/null || printf unknown)"
if ! command -v ps >/dev/null 2>&1; then
  note "ps:       not found in PATH"
  note "Result: CRITICAL"
  exit 2
fi

rows=$(ps -eo pid,ppid,stat,user,comm 2>/dev/null | awk 'NR == 1 || $3 ~ /^Z/')
zombies=$(printf '%s\n' "$rows" | awk 'NR > 1 {n++} END {print n+0}')
note "Zombies:  ${zombies}"
note ""
printf '%s\n' "$rows"
note ""

if [ "$zombies" -ge 10 ]; then
  note "          CRITICAL: zombie count is high (reaper/parent likely stuck)"
  bump crit
elif [ "$zombies" -gt 0 ]; then
  note "          WARNING: unreaped child processes are present"
  bump warn
else
  note "          OK"
fi
note ""

case $status in
  0) note "Result: HEALTHY" ;;
  1) note "Result: WARNING" ;;
  *) note "Result: CRITICAL" ;;
esac
exit "$status"

Raw endpointhttps://runny.sh/r/5CCN57M56WR5

See something unsafe?

Report this script

Tell us why it should come down. Anyone can also report a URL at /abuse.

Restore revision