This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tsg-tsg-diagnose/scripts/tsg-diagnose-periodical
2022-09-23 16:37:22 +08:00

46 lines
1.0 KiB
Bash

#!/bin/bash -e
K3S_BIN_PATH="/usr/bin/k3s"
count_service_function=1
ARGS=`getopt -a -o c:h -l count-service-function:,help -- "$@"`
eval set -- "${ARGS}"
usage(){
echo ""
echo "usage: tsg-diagnose-oneshot [option]"
echo ""
echo "Options:"
echo " -h --help Detailed usage syntax"
echo " -c --count-service-function Count of service-function,default:1"
exit 0
}
function get_args(){
while true
do
case "$1" in
-c|--count-sf)
export count_service_function=$2
;;
-h|--help)
usage
;;
--)
shift
break
;;
esac
shift
done
}
get_args $@
if [ -f "$K3S_BIN_PATH" ]; then
kubectl exec -it daemonset/dign-client -- python bin/client.py -C $count_service_function
else
systemctl start tsg-diagnose
sleep 10
docker exec -it dign-client /bin/sh -c "python bin/client.py -l"
fi