diff options
author | Aaron Crickenberger <aaron.crickenberger@hp.com> | 2012-11-08 15:35:06 -0800 |
---|---|---|
committer | Aaron Crickenberger <aaron.crickenberger@hp.com> | 2012-11-08 15:35:36 -0800 |
commit | 52389f90f2167701802a7eee16b9b758fa600fe6 (patch) | |
tree | 6b9345711238c54db56f66b4e3c49aa4609330b7 /run_local.sh | |
parent | 844492a8eb044a3fda85b607424151f60e11c830 (diff) | |
download | python-troveclient-52389f90f2167701802a7eee16b9b758fa600fe6.tar.gz |
Add -h/-? and print_usage to run_local.sh
Change-Id: I0772db02d10804759d86bacb56a9cccb2a0a922d
Diffstat (limited to 'run_local.sh')
-rwxr-xr-x | run_local.sh | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/run_local.sh b/run_local.sh index f4953e1..c5c8251 100755 --- a/run_local.sh +++ b/run_local.sh @@ -4,32 +4,51 @@ # This script will create a .pid file and report in the current directory. set -e + +me=${0##*/} + +function print_usage() { + cat >&2 <<EOS +Run tests against a local instance of reddwarf + +Usage: $me reddwarf_path [logfile] +EOS +} + +# parse options +while getopts ":h" opt; do + case "$opt" in + h|\?) print_usage; exit 5 ;; + esac +done +shift $((OPTIND-1)) + if [ $# -lt 1 ]; then - echo "Please give the path to the RDL repo as argument one." + print_usage exit 5 -else - RDL_PATH=$1 fi +reddwarf_path=$1 +reddwarf_pid_file="`pwd`.pid" -PID_FILE="`pwd`.pid" - +# the funmaker function start_server() { - pushd $RDL_PATH - bin/start_server.sh --pid_file=$PID_FILE + pushd $reddwarf_path + bin/start_server.sh --pid_file=$reddwarf_pid_file popd } function stop_server() { - if [ -f $PID_FILE ]; + if [ -f $reddwarf_pid_file ]; then - pushd $RDL_PATH - bin/stop_server.sh $PID_FILE + pushd $reddwarf_path + bin/stop_server.sh $reddwarf_pid_file popd else echo "The pid file did not exist, so not stopping server." fi } + function on_error() { echo "Something went wrong!" stop_server |