Spaces:
hstz
/
Running

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

Update update_and_restart.sh

Browse files
Files changed (1) hide show
  1. update_and_restart.sh +28 -12
update_and_restart.sh CHANGED
@@ -1,16 +1,32 @@
1
  #!/bin/sh
2
- while true;
3
- 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
- echo "updating GeoLite2-ASN.mmdb..."
8
- curl -L -o "GeoLite2-ASN.mmdb" "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-ASN.mmdb"
9
- echo "updating GeoCN.mmdb..."
10
- curl -L -o "GeoCN.mmdb" "http://github.com/ljxi/GeoCN/releases/download/Latest/GeoCN.mmdb"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
- echo "restarting uvicorn..."
13
- pkill -f "uvicorn"
14
- nohup uvicorn main:app --host 0.0.0.0 --port 8080 --no-server-header --proxy-headers &
15
- sleep 86400;
16
  done
 
1
  #!/bin/sh
2
+
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