blob: 62970b429bff47532ac4b67a94d4fdc171be7be1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/bin/bash -e
K3S_BIN_PATH="/usr/bin/k3s"
max_service_function_index=1
service_function_index=""
ARGS=`getopt -a -o m:i:h -l max-service-function-index:,service-function-index:,help -- "$@"`
eval set -- "${ARGS}"
usage(){
echo ""
echo "usage: tsg-diagnose-oneshot [option]"
echo ""
echo "Options:"
echo " -h --help Detailed usage syntax"
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
}
function get_args(){
while true
do
case "$1" in
-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
;;
--)
shift
break
;;
esac
shift
done
}
get_args $@
if [ -f "$K3S_BIN_PATH" ]; then
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
docker exec -it dign-client /bin/sh -c "python bin/client.py -o"
fi
|