X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fmstop.sh;fp=src%2Fceph%2Fsrc%2Fmstop.sh;h=6aae78873615104ce8f9b06976dcf50880edff0b;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/src/mstop.sh b/src/ceph/src/mstop.sh new file mode 100755 index 0000000..6aae788 --- /dev/null +++ b/src/ceph/src/mstop.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +set -e + +script_root=`dirname $0` + +if [ -e CMakeCache.txt ]; then + script_root=$PWD +elif [ -e $script_root/../build/CMakeCache.txt ]; then + script_root=`(cd $script_root/../build; pwd)` +fi + +[ "$#" -lt 1 ] && echo "usage: $0 [entity [id]]" && exit 1 + +name=$1 +entity=$2 +id=$3 + +run_root=$script_root/run/$name +pidpath=$run_root/out + +if [ "$entity" == "" ]; then + pfiles=`ls $pidpath/*.pid` || true +elif [ "$id" == "" ]; then + pfiles=`ls $pidpath/$entity.*.pid` || true +else + pfiles=`ls $pidpath/$entity.$id.pid` || true +fi + +for pidfile in $pfiles; do + pid=`cat $pidfile` + fname=`echo $pidfile | sed 's/.*\///g'` + echo $pid + [ "$pid" == "" ] && exit + [ $pid -eq 0 ] && exit + echo pid=$pid + extra_check="" + entity=`echo $fname | sed 's/\..*//g'` + [ "$entity" == "radosgw" ] && extra_check="-e lt-radosgw" + echo entity=$entity pid=$pid + while ps -p $pid -o args= | grep -q -e $entity $extracheck ; do + cmd="kill $signal $pid" + printf "$cmd..." + $cmd + sleep 1 + continue + done +done +