spit them out
This commit is contained in:
parent
a588e2807f
commit
d143be1ed0
16
bot.sh
16
bot.sh
@ -20,7 +20,7 @@ speedtest_upload_meter=data/speedtest_upload_meter_$date.png
|
|||||||
speedtest_meter_image=data/speedtest_meter_image_$date.png
|
speedtest_meter_image=data/speedtest_meter_image_$date.png
|
||||||
weather_file=data/weather_$date.json
|
weather_file=data/weather_$date.json
|
||||||
edited_image=data/edited_image_$date.png
|
edited_image=data/edited_image_$date.png
|
||||||
|
tg_log=data/tg_log_$date.json
|
||||||
#################################################################################
|
#################################################################################
|
||||||
latency(){
|
latency(){
|
||||||
echo $(ping -c 1 $1) | \
|
echo $(ping -c 1 $1) | \
|
||||||
@ -49,7 +49,7 @@ echo Satellite Image grabbed
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
echo Doing speedtest by Ookla
|
echo Doing speedtest by Ookla
|
||||||
# Run speedtest and output to a file
|
# Run speedtest and output to a file
|
||||||
speedtest --json > $speedtest_ookla
|
speedtest --json | tee$speedtest_ookla
|
||||||
# Extract information from the speedtest output
|
# Extract information from the speedtest output
|
||||||
|
|
||||||
# Parsing JSON data
|
# Parsing JSON data
|
||||||
@ -70,8 +70,8 @@ ookla_bytes_sent_mb=$(echo "scale=2; $ookla_bytes_sent / 1048576" | bc)
|
|||||||
|
|
||||||
ookla_total=$(echo $ookla_bytes_sent_mb+$ookla_bytes_received_mb | bc)
|
ookla_total=$(echo $ookla_bytes_sent_mb+$ookla_bytes_received_mb | bc)
|
||||||
|
|
||||||
#echo Starting LibreSpeed
|
echo Starting LibreSpeed
|
||||||
librespeed-cli --json > $speedtest_libre
|
librespeed-cli --json | tee$speedtest_libre
|
||||||
|
|
||||||
# Parsing JSON data
|
# Parsing JSON data
|
||||||
libre_bytes_sent=$(jq '.[0].bytes_sent' "$speedtest_libre")
|
libre_bytes_sent=$(jq '.[0].bytes_sent' "$speedtest_libre")
|
||||||
@ -87,8 +87,8 @@ libre_bytes_received_mb=$(echo "scale=2; $libre_bytes_received / 1048576" | bc)
|
|||||||
|
|
||||||
libre_total=$(echo $libre_bytes_sent_mb+$libre_bytes_received_mb | bc)
|
libre_total=$(echo $libre_bytes_sent_mb+$libre_bytes_received_mb | bc)
|
||||||
|
|
||||||
#echo Starting Fast
|
echo Starting Fast
|
||||||
fast --upload --json > $speedtest_fast
|
fast --upload --json | tee$speedtest_fast
|
||||||
fast_download_speed=$(jq '.downloadSpeed' "$speedtest_fast")
|
fast_download_speed=$(jq '.downloadSpeed' "$speedtest_fast")
|
||||||
fast_upload_speed=$(jq '.uploadSpeed' "$speedtest_fast")
|
fast_upload_speed=$(jq '.uploadSpeed' "$speedtest_fast")
|
||||||
fast_latency=$(jq '.latency' "$speedtest_fast")
|
fast_latency=$(jq '.latency' "$speedtest_fast")
|
||||||
@ -113,7 +113,7 @@ googledns_ping=$(latency 8.8.8.8)
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
echo Checking weather
|
echo Checking weather
|
||||||
# Make the API request
|
# Make the API request
|
||||||
curl -s "https://api.open-meteo.com/v1/forecast?latitude=${LATITUDE}&longitude=${LONGITUDE}¤t_weather=true" > $weather_file
|
curl -s "https://api.open-meteo.com/v1/forecast?latitude=${LATITUDE}&longitude=${LONGITUDE}¤t_weather=true" | tee$weather_file
|
||||||
# Extract Weather Condition and day or not
|
# Extract Weather Condition and day or not
|
||||||
weather_condition=$(jq '.current_weather.weathercode' "$weather_file")
|
weather_condition=$(jq '.current_weather.weathercode' "$weather_file")
|
||||||
is_day=$(jq '.current_weather.is_day' "$weather_file")
|
is_day=$(jq '.current_weather.is_day' "$weather_file")
|
||||||
@ -234,7 +234,7 @@ curl -X POST https://api.telegram.org/bot$TG_BOT_TOKEN/sendMediaGroup \
|
|||||||
-F chat_id=$TG_CHATID \
|
-F chat_id=$TG_CHATID \
|
||||||
-F media='[{"type": "photo", "media": "attach://photo1", "caption": "'"$caption"'", "parse_mode": "Markdown"}, {"type": "photo", "media": "attach://photo2"}]' \
|
-F media='[{"type": "photo", "media": "attach://photo1", "caption": "'"$caption"'", "parse_mode": "Markdown"}, {"type": "photo", "media": "attach://photo2"}]' \
|
||||||
-F photo1=@$speedtest_meter_image \
|
-F photo1=@$speedtest_meter_image \
|
||||||
-F photo2=@$satellite_image >> /dev/null
|
-F photo2=@$satellite_image | tee $tg_log
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
echo Ok done, Sleeping for $DELAY
|
echo Ok done, Sleeping for $DELAY
|
||||||
|
Loading…
x
Reference in New Issue
Block a user