fintic-tracker/check_update.sh

56 lines
762 B
Bash
Raw Permalink Normal View History

2022-02-27 17:22:35 +00:00
#!/bin/bash
2022-10-05 08:13:10 +00:00
sleep 120
2022-03-08 10:23:06 +00:00
2022-10-05 08:19:59 +00:00
internet="offline"
wget -q --spider http://google.com
if [ $? -eq 0 ]; then
internet="online"
else
internet="offline"
fi
if [[ $internet = "online" ]]; then
2022-02-27 17:22:35 +00:00
value=$(<csv/system_info.json)
echo "${value}"
IFS=:, read -ra x <<< "$value"
for i in ${x[@]}
do
echo $i
done
[ $(git rev-parse HEAD) = $(git ls-remote $(git rev-parse --abbrev-ref @{u} | \
sed 's/\// /g') | cut -f1) ] && x[1]=" false" || x[1]=" true"
str1=$(IFS=:; echo "${x[*]:0:2}")
str2=$(IFS=:; echo "${x[*]:2:2}")
ar2=("${str1}" "${str2}")
for i in ${ar2[@]}
do
echo $i
done
str=$(IFS=,; echo "${ar2[*]}")
2022-03-07 20:42:27 +00:00
sudo chmod 777 csv/system_info.json
2022-02-27 17:22:35 +00:00
rm csv/system_info.json
2022-03-07 20:35:45 +00:00
2022-02-27 17:22:35 +00:00
echo "$str" >> csv/system_info.json
2022-04-10 12:06:03 +00:00
2022-03-07 20:42:27 +00:00
sudo chmod 777 csv/system_info.json
2022-03-07 20:35:45 +00:00
2022-10-05 08:19:59 +00:00
fi
2022-02-27 17:22:35 +00:00