mirror of
https://github.com/ceph/ceph
synced 2025-02-21 18:17:42 +00:00
The print information of mstop.sh is as following: entity=osd pid=16347 name=osd.1 kill 16347...kill 16347...16462 pid=16462 entity=osd pid=16462 name=osd.2 kill 16462...kill 16462...[root@maozy build]# It's not clear enough, so fix it. Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
50 lines
1.1 KiB
Bash
Executable File
50 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env 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 <name> [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'`
|
|
[ "$pid" == "" ] && exit
|
|
[ $pid -eq 0 ] && exit
|
|
echo pid=$pid
|
|
extra_check=""
|
|
entity=`echo $fname | sed 's/\..*//g'`
|
|
name=`echo $fname | sed 's/\.pid$//g'`
|
|
[ "$entity" == "radosgw" ] && extra_check="-e lt-radosgw"
|
|
echo entity=$entity pid=$pid name=$name
|
|
while ps -p $pid -o args= | grep -q -e $entity $extracheck ; do
|
|
cmd="kill $signal $pid"
|
|
printf "$cmd...\n"
|
|
$cmd
|
|
sleep 1
|
|
continue
|
|
done
|
|
done
|
|
|