]> git.proxmox.com Git - ceph.git/blame - ceph/src/mstop.sh
update sources to 12.2.2
[ceph.git] / ceph / src / mstop.sh
CommitLineData
7c673cae
FG
1#!/bin/bash
2
3set -e
4
5script_root=`dirname $0`
6
7if [ -e CMakeCache.txt ]; then
8 script_root=$PWD
9elif [ -e $script_root/../build/CMakeCache.txt ]; then
10 script_root=`(cd $script_root/../build; pwd)`
11fi
12
13[ "$#" -lt 1 ] && echo "usage: $0 <name> [entity [id]]" && exit 1
14
15name=$1
16entity=$2
17id=$3
18
19run_root=$script_root/run/$name
20pidpath=$run_root/out
21
22if [ "$entity" == "" ]; then
23 pfiles=`ls $pidpath/*.pid` || true
24elif [ "$id" == "" ]; then
25 pfiles=`ls $pidpath/$entity.*.pid` || true
26else
27 pfiles=`ls $pidpath/$entity.$id.pid` || true
28fi
29
30for 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
48done
49