diff --git a/shredder.sh b/shredder.sh index c321183..78ba718 100644 --- a/shredder.sh +++ b/shredder.sh @@ -44,7 +44,9 @@ done while true; do for child in ${children}; do - activeChildren="${activeChildren} $(ps T | grep $child | awk '{print $1}')" + if kill -0 ${child}; then + activeChildren="${activeChildren} ${child}" + fi done # if no active children, trim the whitespace so we can check for empty string