killTree.sh 183 B

12345678910111213
  1. #!/bin/sh
  2. ROOT_PID=$1
  3. SIGNAL=$2
  4. terminateTree() {
  5. for cpid in $(/usr/bin/pgrep -P $1); do
  6. terminateTree $cpid
  7. done
  8. kill -$SIGNAL $1 > /dev/null 2>&1
  9. }
  10. terminateTree $ROOT_PID