From 8b00ce12bf2fbde7302e17bdacec34fdd8bf9d3f Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Thu, 20 Mar 2014 00:01:35 +0000 Subject: [PATCH] HBASE-10797 Add support for -h and --help to rolling_restart.sh and fix the usage string output git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1579477 13f79535-47bb-0310-9956-ffa450edef68 --- bin/rolling-restart.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/bin/rolling-restart.sh b/bin/rolling-restart.sh index a1a162b25f7..f58ef0a3e8f 100755 --- a/bin/rolling-restart.sh +++ b/bin/rolling-restart.sh @@ -34,7 +34,11 @@ # # Modelled after $HADOOP_HOME/bin/slaves.sh. -usage="Usage: $0 [--config ] [--rs-only] [--master-only] [--graceful] [--maxthreads xx]" +usage_str="Usage: `basename $0` [--config ] [--rs-only] [--master-only] [--graceful] [--maxthreads xx]" + +function usage() { + echo "${usage_str}" +} bin=`dirname "$0"` bin=`cd "$bin">/dev/null; pwd` @@ -48,12 +52,6 @@ then exit $errCode fi -function usage() { - echo $usage - exit 1 -} - - RR_RS=1 RR_MASTER=1 RR_GRACEFUL=0 @@ -84,8 +82,12 @@ while [ $# -gt 0 ]; do RR_MAXTHREADS=$1 shift ;; + --help|-h) + usage + exit 0 + ;; *) - echo Bad argument: $x + echo Bad argument: $1 usage exit 1 ;;