1
0

fix: 修复访问tushare接口过快

This commit is contained in:
2025-09-08 21:10:21 +08:00
parent f1ab38f871
commit 30225afcba
6 changed files with 71 additions and 2 deletions

View File

@@ -0,0 +1,33 @@
#!/bin/bash
original_command="$0"
application_name="/home/ubuntu/app/leopard-server-1.0.0.jar"
function get_pid() {
echo $(ps ef | grep "$application_name" | grep -v grep | awk '{ print $1 }')
}
pid=$(get_pid)
if [[ -z "$pid" ]]; then
echo "Application is already stopped."
exit 0
fi
echo "Stopping $pid..."
kill $pid
LOOPS=0
while (true); do
cpid=$(get_pid)
if [[ -z "$cpid" ]]; then
echo "Oook! cost:$LOOPS"
break
fi
LOOPS=$(($LOOPS+1))
if [[ $(($LOOPS%15)) -eq 0 ]]; then
echo "Wait timeout, try to force kill $pid..."
kill -9 $pid
fi
sleep 1s
done