28 lines
968 B
Bash
28 lines
968 B
Bash
#!/bin/bash
|
|
|
|
LogPath=/var/log/xray/geoip_update.log
|
|
|
|
|
|
rm -rf /usr/local/share/xray/geosite.dat
|
|
rm -rf /usr/local/share/xray/geoip.dat
|
|
echo "current time is $(date), start to update geo ip for xray" >> $LogPath
|
|
|
|
curl --connect-timeout 5 -s -o /dev/null https://www.google.com
|
|
if [[ $? -eq 0 ]];then
|
|
echo "start to download from github !"
|
|
wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat -O /usr/local/share/xray/geosite.dat
|
|
|
|
wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat -O /usr/local/share/xray/geoip.dat
|
|
else
|
|
echo "start to download from jsdelivr !"
|
|
wget https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat -O /usr/local/share/xray/geosite.dat
|
|
|
|
wget https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat -O /usr/local/share/xray/geoip.dat
|
|
fi
|
|
|
|
|
|
echo "start to restrat xray !" >> $LogPath
|
|
systemctl restart xray
|
|
|
|
|