From 8cc6301f9f8414c18f483dca2fdcf23315423a51 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 8 Dec 2015 13:41:07 -0800 Subject: [PATCH] mstop.sh, mrgw.sh: more scripts to control daemons in dev env Signed-off-by: Yehuda Sadeh --- src/mrgw.sh | 19 +++++++++++++++++++ src/mstop.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100755 src/mrgw.sh create mode 100755 src/mstop.sh diff --git a/src/mrgw.sh b/src/mrgw.sh new file mode 100755 index 0000000000000..ce309e5af682b --- /dev/null +++ b/src/mrgw.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +script_root=`dirname $0` + +[ "$#" -lt 2 ] && echo "usage: $0 [params...]" && exit 1 + +name=$1 +port=$2 + +shift 2 + +run_root=$script_root/run/$name +pidfile=$run_root/out/radosgw.${port}.pid + +$script_root/mstop.sh $name radosgw $port + +$script_root/mrun $name radosgw --rgw-frontends="civetweb port=$port" --pid-file=$pidfile "$@" diff --git a/src/mstop.sh b/src/mstop.sh new file mode 100755 index 0000000000000..7fb971bd00a80 --- /dev/null +++ b/src/mstop.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -e + +script_root=`dirname $0` + +[ "$#" -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 + -- 2.39.5