57 lines
1.6 KiB
Bash
57 lines
1.6 KiB
Bash
#!/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 -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
|
|
docker exec -it dign-client /bin/sh -c "python bin/client.py -l"
|
|
fi
|
|
|