vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # get the PIDs of java processes we started |
| 4 | if [ "$JAVA_HOME" != "" ] |
| 5 | then |
| 6 | PIDS=`$JAVA_HOME/bin/jps` |
| 7 | else |
| 8 | PIDS=`jps` |
| 9 | fi |
| 10 | |
| 11 | while IFS='\n' read -ra MYPIDS; do |
| 12 | for i in "${MYPIDS[@]}"; do |
| 13 | pid=`echo $i | grep 'CCDriver\|NCDriver\|VirtualClusterDriver' | awk '{print $1}'` |
| 14 | name=`echo $i | grep 'CCDriver\|NCDriver\|VirtualClusterDriver' | awk '{print $2}'` |
| 15 | if [ "$pid" != "" ] |
| 16 | then |
| 17 | echo "Stopping $name: $pid" |
| 18 | kill -9 $pid |
| 19 | fi |
| 20 | done |
| 21 | done <<< "$PIDS" |