Skip to content

Instantly share code, notes, and snippets.

@kopertop
Created August 5, 2013 15:50
Show Gist options
  • Save kopertop/6156990 to your computer and use it in GitHub Desktop.
Save kopertop/6156990 to your computer and use it in GitHub Desktop.
Ping to OnSip servers to see your latency, and report using Blink(1) Control program: http://thingm.com/products/blink-1.html
#!/bin/sh
GREEN='#00ff00'
YELLOW='#ffc000'
RED='#ff0000'
PTIME="`ping -c 1 sip.onsip.com|grep time=|awk '{split($7,a,"="); split(a[2],b,".");print b[1]}'`"
echo "PING TIME: $PTIME"
if [ $PTIME -lt 60 ];
then
echo "GREEN: $GREEN"
elif [ $PTIME -lt 120 ];
then
echo "YELLOW: $YELLOW"
else
echo "RED: $RED"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment