r00igev@@r
Honorary Master
- Joined
- Dec 14, 2009
- Messages
- 15,639
- Reaction score
- 14,157
- Location
- Draadloos Bantha poo doo in 4ways
So a while ago the forum script wizards helped me create a script for Uptime Kuma that measured speedtests. Its decent.

So my next one was to measure loss to cloudflare/quad9 as I was noticing occasional loss. Here is my script. Was wondering if this is the most optimal and if there is a better way of doing it?
Just implemented it and it seems fine!


So my next one was to measure loss to cloudflare/quad9 as I was noticing occasional loss. Here is my script. Was wondering if this is the most optimal and if there is a better way of doing it?
#!/bin/bash
packet=$(ping -c 20 $1 | grep "packet loss" | awk -F ',' '{print $3}' | awk '{print $1}')
loss=$(echo $packet | rev | cut -c 2- | rev )
if [[ $loss < "3" ]]; then
curl -k -s "https://uptime.example.com/api/push/key?status=up&msg=OK&ping=$loss"
fi
Just implemented it and it seems fine!

