Spaces:
hstz
/
Running

IPGEO commited on
Commit
7d8d5c3
·
verified ·
1 Parent(s): 522bab5

Update update_and_restart.sh

Browse files
Files changed (1) hide show
  1. update_and_restart.sh +18 -18
update_and_restart.sh CHANGED
@@ -3,30 +3,30 @@
3
  while true; do
4
  date
5
  echo "Updating GeoLite2-City.mmdb..."
6
- curl -L -o "GeoLite2-City.mmdb" "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb"
7
 
8
  echo "Updating GeoLite2-ASN.mmdb..."
9
- curl -L -o "GeoLite2-ASN.mmdb" "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-ASN.mmdb"
10
 
11
  echo "Updating GeoCN.mmdb..."
12
- curl -L -o "GeoCN.mmdb" "http://github.com/ljxi/GeoCN/releases/download/Latest/GeoCN.mmdb"
13
 
14
  echo "Attempting to restart uvicorn..."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- while true; do
17
- uvicorn main:app --host 0.0.0.0 --port 8080 --no-server-header --proxy-headers &
18
-
19
- sleep 5
20
-
21
- if pgrep -f "uvicorn main:app" > /dev/null; then
22
- echo "uvicorn restarted successfully."
23
- break
24
- else
25
- echo "Failed to start uvicorn. Retrying in 5 seconds..."
26
- pkill -f "uvicorn"
27
- sleep 5
28
- fi
29
- done
30
-
31
  sleep 86400
32
  done
 
3
  while true; do
4
  date
5
  echo "Updating GeoLite2-City.mmdb..."
6
+ curl -L -o "GeoLite2-City.mmdb" "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb" || { echo "Failed to update GeoLite2-City.mmdb"; continue; }
7
 
8
  echo "Updating GeoLite2-ASN.mmdb..."
9
+ curl -L -o "GeoLite2-ASN.mmdb" "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-ASN.mmdb" || { echo "Failed to update GeoLite2-ASN.mmdb"; continue; }
10
 
11
  echo "Updating GeoCN.mmdb..."
12
+ curl -L -o "GeoCN.mmdb" "http://github.com/ljxi/GeoCN/releases/download/Latest/GeoCN.mmdb" || { echo "Failed to update GeoCN.mmdb"; continue; }
13
 
14
  echo "Attempting to restart uvicorn..."
15
+ pkill -f "uvicorn"
16
+
17
+ nohup uvicorn main:app --host 0.0.0.0 --port 8080 --no-server-header --proxy-headers &
18
+
19
+ # 等待一段时间检查服务是否成功启动
20
+ sleep 5
21
+
22
+ # 检查 uvicorn 是否正在运行
23
+ if pgrep -f "uvicorn" > /dev/null; then
24
+ echo "uvicorn restarted successfully."
25
+ else
26
+ echo "Failed to restart uvicorn, retrying..."
27
+ continue
28
+ fi
29
 
30
+ # 每隔一段时间更新一次数据
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  sleep 86400
32
  done