update shell script

This commit is contained in:
idea4good 2022-06-13 12:30:33 +08:00
parent 4eba1d2b13
commit 52478f4d64
2 changed files with 13 additions and 21 deletions

View File

@ -8,32 +8,24 @@ build_time=`date +%Y-%m-%dT%H:%M:%S.000%z`
device_info=`uname -s -n -m`
#--------------- Geo info ----------------#
if [ ! -f "/tmp/ip_info.tmp" ]; then
curl ipinfo.io > /tmp/ip_info.tmp # get IP info
fi
timeout 30s curl ipinfo.io > /tmp/ip_info.tmp # get IP info
if [ ! -f "/tmp/ip_city.tmp" ]; then
grep city /tmp/ip_info.tmp > /tmp/ip_city.tmp # filter city
sed -i 's/"city"://g' /tmp/ip_city.tmp #remove property name
sed -i 's/"//g' /tmp/ip_city.tmp #remove double quotes
fi
grep city /tmp/ip_info.tmp > /tmp/ip_city.tmp # filter city
sed -i 's/"city"://g' /tmp/ip_city.tmp #remove property name
sed -i 's/"//g' /tmp/ip_city.tmp #remove double quotes
city=`sed 's/,//g' /tmp/ip_city.tmp` #remove comma
if [ ! -f "/tmp/ip_country.tmp" ]; then
grep country /tmp/ip_info.tmp > /tmp/ip_country.tmp # filter country
sed -i 's/"country"://g' /tmp/ip_country.tmp #remove property name
sed -i 's/"//g' /tmp/ip_country.tmp #remove double quotes
fi
grep country /tmp/ip_info.tmp > /tmp/ip_country.tmp # filter country
sed -i 's/"country"://g' /tmp/ip_country.tmp #remove property name
sed -i 's/"//g' /tmp/ip_country.tmp #remove double quotes
country=`sed 's/,//g' /tmp/ip_country.tmp` #remove comma
if [ ! -f "/tmp/ip_org.tmp" ]; then
grep org /tmp/ip_info.tmp > /tmp/ip_org.tmp # filter org
sed -i 's/"org"://g' /tmp/ip_org.tmp #remove property name
sed -i 's/"//g' /tmp/ip_org.tmp #remove double quotes
fi
grep org /tmp/ip_info.tmp > /tmp/ip_org.tmp # filter org
sed -i 's/"org"://g' /tmp/ip_org.tmp #remove property name
sed -i 's/"//g' /tmp/ip_org.tmp #remove double quotes
org=`sed 's/,//g' /tmp/ip_org.tmp` #remove comma
curl --include --request POST --header "Content-Type: application/json" --data-binary "[{
timeout 30s curl --include --request POST --header "Content-Type: application/json" --data-binary "[{
\"device_info\" :\"$device_info\",
\"project_info\" :\"$1\",
\"time\" :\"$build_time\",
@ -43,4 +35,4 @@ curl --include --request POST --header "Content-Type: application/json" --data-b
\"org\" :\"$org\",
\"log\" :\"$build_time\",
\"version\" :\"v2.2\"
}]" $url > /dev/null
}]" $url

View File

@ -50,4 +50,4 @@ echo "You could find GuiLite.h in root folder"
# clean
rm *.h *.cpp *.o
./.sync.sh GuiLite-header
./.sync.sh GuiLite-header > .sync_log.txt 2>&1 &