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

View File

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