]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/bin/bash |
2 | ||
3 | set -e | |
4 | ||
5 | script_root=`dirname $0` | |
6 | ||
7 | if [ -e CMakeCache.txt ]; then | |
8 | script_root=$PWD | |
9 | elif [ -e $script_root/../build/CMakeCache.txt ]; then | |
10 | script_root=`(cd $script_root/../build; pwd)` | |
11 | fi | |
12 | ||
13 | [ "$#" -lt 1 ] && echo "usage: $0 <name> [entity [id]]" && exit 1 | |
14 | ||
15 | name=$1 | |
16 | entity=$2 | |
17 | id=$3 | |
18 | ||
19 | run_root=$script_root/run/$name | |
20 | pidpath=$run_root/out | |
21 | ||
22 | if [ "$entity" == "" ]; then | |
23 | pfiles=`ls $pidpath/*.pid` || true | |
24 | elif [ "$id" == "" ]; then | |
25 | pfiles=`ls $pidpath/$entity.*.pid` || true | |
26 | else | |
27 | pfiles=`ls $pidpath/$entity.$id.pid` || true | |
28 | fi | |
29 | ||
30 | for pidfile in $pfiles; do | |
31 | pid=`cat $pidfile` | |
32 | fname=`echo $pidfile | sed 's/.*\///g'` | |
33 | echo $pid | |
34 | [ "$pid" == "" ] && exit | |
35 | [ $pid -eq 0 ] && exit | |
36 | echo pid=$pid | |
37 | extra_check="" | |
38 | entity=`echo $fname | sed 's/\..*//g'` | |
39 | [ "$entity" == "radosgw" ] && extra_check="-e lt-radosgw" | |
40 | echo entity=$entity pid=$pid | |
41 | while ps -p $pid -o args= | grep -q -e $entity $extracheck ; do | |
42 | cmd="kill $signal $pid" | |
43 | printf "$cmd..." | |
44 | $cmd | |
45 | sleep 1 | |
46 | continue | |
47 | done | |
48 | done | |
49 |