Last active
August 1, 2016 07:13
-
-
Save schtobia/2740ee90e13a7f27ca18811f1e1e9b29 to your computer and use it in GitHub Desktop.
Kill all zombies, with increasing vigor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
for current_signal in HUP TERM KILL SEGV; | |
do | |
ZOMBIES=$(ps -A -ostat,ppid | sed -rn 's/^[zZ][^[:space:]]*[[:space:]]*([0-9]+)/\1/p' | sort -nu); | |
[ -n "$ZOMBIES" ] && { kill -s $current_signal $ZOMBIES; sleep 2; } || true; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment