diff --git a/setup/bindir/cloud-sysvmadm.in b/setup/bindir/cloud-sysvmadm.in index 5e3c3492308..6fdfa9cb439 100755 --- a/setup/bindir/cloud-sysvmadm.in +++ b/setup/bindir/cloud-sysvmadm.in @@ -5,7 +5,7 @@ #set -x usage() { - printf "\nThe tool stopping/starting running system vms and domain routers \n\nUsage: %s: [-d] [-u] [-p] [-s] [-r] [-a] \n\n -d - cloud DB server ip address, defaulted to localhost if not specified \n -u - user name to access cloud DB, defaulted to "root" if not specified \n -p - cloud DB user password, defaulted to no password if not specified \n\n -s - stop then start all running SSVMs and Console Proxies \n -r - stop then start all running Virtual Routers\n -a - stop then start all running SSVMs, Console Proxies, and Virtual Routers\n\n" $(basename $0) >&2 + printf "\nThe tool stopping/starting running system vms and domain routers \n\nUsage: %s: [-d] [-u] [-p] [-m] [-s] [-r] [-a] \n\n -d - cloud DB server ip address, defaulted to localhost if not specified \n -u - user name to access cloud DB, defaulted to "root" if not specified \n -p - cloud DB user password, defaulted to no password if not specified \n\n -m - the ip address of management server, defaulted to localhost if not specified\n\n -s - stop then start all running SSVMs and Console Proxies \n -r - stop then start all running Virtual Routers\n -a - stop then start all running SSVMs, Console Proxies, and Virtual Routers\n\n" $(basename $0) >&2 } @@ -13,11 +13,13 @@ system= router= all= db=localhost +ms=localhost user=root password= +help= -while getopts 'sard:u:p:' OPTION +while getopts 'sarhd:m:u:p:' OPTION do case $OPTION in s) system=1 @@ -32,6 +34,10 @@ do ;; p) password="$OPTARG" ;; + h) help=1 + ;; + m) ms="$OPTARG" + ;; ?) usage esac done @@ -114,7 +120,7 @@ stop_start_router } send_request(){ -jobid=`curl -sS "http://localhost:8096/?command=$1&id=$2&response=json" | sed 's/\"//g' | sed 's/ //g' | sed 's/{//g' | sed 's/}//g' | awk -F: {'print $3'}` +jobid=`curl -sS "http://$ms:8096/?command=$1&id=$2&response=json" | sed 's/\"//g' | sed 's/ //g' | sed 's/{//g' | sed 's/}//g' | awk -F: {'print $3'}` if [ "$jobid" == "" ]; then echo 2 return @@ -126,7 +132,7 @@ echo $jobresult query_async_job_result() { while [ 1 ] do - jobstatus=`curl -sS "http://localhost:8096/?command=queryAsyncJobResult&jobId=$1&response=json" | sed 's/\"//g' | sed 's/ //g' | sed 's/{//g' | sed 's/}//g' | awk -F, {'print $2'} | awk -F: {'print $2'}` + jobstatus=`curl -sS "http://$ms:8096/?command=queryAsyncJobResult&jobId=$1&response=json" | sed 's/\"//g' | sed 's/ //g' | sed 's/{//g' | sed 's/}//g' | awk -F, {'print $2'} | awk -F: {'print $2'}` if [ "$jobstatus" != "0" ]; then echo $jobstatus break @@ -135,12 +141,17 @@ sleep 5 done } -if [ "$system$router$all" == "" ] +if [ "$system$router$all$help" == "" ] then usage exit fi +if [ "$help" == "1" ] +then + usage + exit +fi if [ "$all" == "1" ] then