5 script_root=`dirname $0`
7 [ -z "$BUILD_DIR" ] && BUILD_DIR=build
9 if [ -e CMakeCache.txt ]; then
11 elif [ -e $script_root/../${BUILD_DIR}/CMakeCache.txt ]; then
12 script_root=`(cd $script_root/../${BUILD_DIR}; pwd)`
15 [ "$#" -lt 1 ] && echo "usage: $0 <name> [entity [id]]" && exit 1
21 run_root=$script_root/run/$name
24 if [ "$entity" == "" ]; then
25 pfiles=`ls $pidpath/*.pid` || true
26 elif [ "$id" == "" ]; then
27 pfiles=`ls $pidpath/$entity.*.pid` || true
29 pfiles=`ls $pidpath/$entity.$id.pid` || true
34 for pidfile in $pfiles; do
36 fname=`echo $pidfile | sed 's/.*\///g'`
37 [ "$pid" == "" ] && exit
38 [ $pid -eq 0 ] && exit
41 entity=`echo $fname | sed 's/\..*//g'`
42 name=`echo $fname | sed 's/\.pid$//g'`
43 [ "$entity" == "radosgw" ] && extra_check="-e lt-radosgw"
44 echo entity=$entity pid=$pid name=$name
47 while ps -p $pid -o args= | grep -q -e $entity $extracheck ; do
48 if [[ "$counter" -gt MAX_RETRIES ]]; then
51 cmd="kill $signal $pid"
55 counter=$((counter+1))