diff --git a/bot.sh b/bot.sh index c124634..62aaa92 100755 --- a/bot.sh +++ b/bot.sh @@ -20,7 +20,7 @@ speedtest_upload_meter=data/speedtest_upload_meter_$date.png speedtest_meter_image=data/speedtest_meter_image_$date.png weather_file=data/weather_$date.json edited_image=data/edited_image_$date.png - +tg_log=data/tg_log_$date.json ################################################################################# latency(){ echo $(ping -c 1 $1) | \ @@ -49,7 +49,7 @@ echo Satellite Image grabbed ################################################################################# echo Doing speedtest by Ookla # Run speedtest and output to a file -speedtest --json > $speedtest_ookla +speedtest --json | tee$speedtest_ookla # Extract information from the speedtest output # 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) -#echo Starting LibreSpeed -librespeed-cli --json > $speedtest_libre +echo Starting LibreSpeed +librespeed-cli --json | tee$speedtest_libre # Parsing JSON data 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) -#echo Starting Fast -fast --upload --json > $speedtest_fast +echo Starting Fast +fast --upload --json | tee$speedtest_fast fast_download_speed=$(jq '.downloadSpeed' "$speedtest_fast") fast_upload_speed=$(jq '.uploadSpeed' "$speedtest_fast") fast_latency=$(jq '.latency' "$speedtest_fast") @@ -113,7 +113,7 @@ googledns_ping=$(latency 8.8.8.8) ################################################################################# echo Checking weather # 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 weather_condition=$(jq '.current_weather.weathercode' "$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 media='[{"type": "photo", "media": "attach://photo1", "caption": "'"$caption"'", "parse_mode": "Markdown"}, {"type": "photo", "media": "attach://photo2"}]' \ -F photo1=@$speedtest_meter_image \ - -F photo2=@$satellite_image >> /dev/null + -F photo2=@$satellite_image | tee $tg_log ################################################################################# echo Ok done, Sleeping for $DELAY