feature:新增max_service_function_index和list_service_function_index输入配置项

This commit is contained in:
fumingwei
2022-10-09 15:26:11 +08:00
parent e5a79a44ac
commit 01cf2b2639
3 changed files with 53 additions and 20 deletions

View File

@@ -1,8 +1,9 @@
#!/bin/bash -e
K3S_BIN_PATH="/usr/bin/k3s"
count_service_function=1
max_service_function_index=1
service_function_index=""
ARGS=`getopt -a -o c:h -l count-service-function:,help -- "$@"`
ARGS=`getopt -a -o m:i:h -l max-service-function-index:,service-function-index:,help -- "$@"`
eval set -- "${ARGS}"
usage(){
echo ""
@@ -10,7 +11,10 @@ usage(){
echo ""
echo "Options:"
echo " -h --help Detailed usage syntax"
echo " -c --count-service-function Count of service-function,default:1"
echo " -m --max-service-function-index Count of service-function,default:1"
echo " -i --service-function-index List of service-function index"
echo "Example: tsg-diagnose-oneshot -m 5"
echo " or tsg-diagnose-oneshot -i 1 -i 2 -i 3"
exit 0
}
@@ -18,8 +22,11 @@ function get_args(){
while true
do
case "$1" in
-c|--count-sf)
export count_service_function=$2
-m|--max-service-function-index)
export max_service_function_index=$2
;;
-i|--service-function-index)
export service_function_index="$2 $service_function_index"
;;
-h|--help)
usage
@@ -36,7 +43,11 @@ function get_args(){
get_args $@
if [ -f "$K3S_BIN_PATH" ]; then
kubectl exec -it daemonset/dign-client -- python bin/client.py -C $count_service_function
if [ -z "$service_function_index" ]; then
kubectl exec -it daemonset/dign-client -- python bin/client.py -m $max_service_function_index
else
kubectl exec -it daemonset/dign-client -- python bin/client.py -d $service_function_index
fi
else
systemctl start tsg-diagnose
sleep 10

View File

@@ -1,8 +1,9 @@
#!/bin/bash -e
K3S_BIN_PATH="/usr/bin/k3s"
count_service_function=1
max_service_function_index=1
service_function_index=""
ARGS=`getopt -a -o c:h -l count-service-function:,help -- "$@"`
ARGS=`getopt -a -o m:i:h -l max-service-function-index:,service-function-index:,help -- "$@"`
eval set -- "${ARGS}"
usage(){
echo ""
@@ -10,7 +11,10 @@ usage(){
echo ""
echo "Options:"
echo " -h --help Detailed usage syntax"
echo " -c --count-service-function Count of service-function,default:1"
echo " -m --max-service-function-index Count of service-function,default:1"
echo " -i --service-function-index List of service-function index"
echo "Example: tsg-diagnose-oneshot -m 5"
echo " or tsg-diagnose-oneshot -i 1 -i 2 -i 3"
exit 0
}
@@ -18,8 +22,11 @@ function get_args(){
while true
do
case "$1" in
-c|--count-sf)
export count_service_function=$2
-m|--max-service-function-index)
export max_service_function_index=$2
;;
-i|--service-function-index)
export service_function_index="$2 $service_function_index"
;;
-h|--help)
usage
@@ -36,7 +43,11 @@ function get_args(){
get_args $@
if [ -f "$K3S_BIN_PATH" ]; then
kubectl exec -it daemonset/dign-client -- python bin/client.py -C $count_service_function
if [ -z "$service_function_index" ]; then
kubectl exec -it daemonset/dign-client -- python bin/client.py -m $max_service_function_index -l
else
kubectl exec -it daemonset/dign-client -- python bin/client.py -d $service_function_index -l
fi
else
systemctl start tsg-diagnose
sleep 10