Skip to content

Instantly share code, notes, and snippets.

@binzram
Created April 20, 2017 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binzram/5de474437b32c9a98058239a3158945a to your computer and use it in GitHub Desktop.
Save binzram/5de474437b32c9a98058239a3158945a to your computer and use it in GitHub Desktop.
Zombie process catcher
#!/bin/bash
ps aux | awk '{if ($8 = "Z") print $1,$2,$8,$11;}' | tee /home/$USER/zombie.tmp
ZCOUNT=$(wc -l /home/$USER/zombie.tmp | awk '{print $1}')
ZCOUNT=$(expr $ZCOUNT - 1)
echo "Total $ZCOUNT zombie processes found."
rm -f /home/$USER/zombie.tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment