Skip to content

Commit eed5859

Browse files
committed
Small fix to script that stop/starts system vms: added -m option (the host we send stop* api requests to); defaulted to localhost if not specified.
1 parent d456f89 commit eed5859

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

setup/bindir/cloud-sysvmadm.in

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@
55
#set -x
66

77
usage() {
8-
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
8+
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
99
}
1010

1111

1212
system=
1313
router=
1414
all=
1515
db=localhost
16+
ms=localhost
1617
user=root
1718
password=
19+
help=
1820

1921

20-
while getopts 'sard:u:p:' OPTION
22+
while getopts 'sarhd:m:u:p:' OPTION
2123
do
2224
case $OPTION in
2325
s) system=1
@@ -32,6 +34,10 @@ do
3234
;;
3335
p) password="$OPTARG"
3436
;;
37+
h) help=1
38+
;;
39+
m) ms="$OPTARG"
40+
;;
3541
?) usage
3642
esac
3743
done
@@ -114,7 +120,7 @@ stop_start_router
114120
}
115121

116122
send_request(){
117-
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'}`
123+
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'}`
118124
if [ "$jobid" == "" ]; then
119125
echo 2
120126
return
@@ -126,7 +132,7 @@ echo $jobresult
126132
query_async_job_result() {
127133
while [ 1 ]
128134
do
129-
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'}`
135+
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'}`
130136
if [ "$jobstatus" != "0" ]; then
131137
echo $jobstatus
132138
break
@@ -135,12 +141,17 @@ sleep 5
135141
done
136142
}
137143

138-
if [ "$system$router$all" == "" ]
144+
if [ "$system$router$all$help" == "" ]
139145
then
140146
usage
141147
exit
142148
fi
143149

150+
if [ "$help" == "1" ]
151+
then
152+
usage
153+
exit
154+
fi
144155

145156
if [ "$all" == "1" ]
146157
then

0 commit comments

Comments
 (0)