EdgeOS Load-Balance Response Time Script

From Michael's Information Zone
Revision as of 19:48, 30 September 2016 by Michael.mast (talk | contribs) (Created page with "<pre> #!/bin/bash ping -O yahoo.com -c 3 2>/dev/null 1>/tmp/testout.log sed -i '1d' /tmp/testout.log sed -i '4,7d' /tmp/testout.log sed -i 's|^.*time=||' /tmp/testout.log sed...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#!/bin/bash
ping -O yahoo.com -c 3 2>/dev/null 1>/tmp/testout.log
sed -i '1d' /tmp/testout.log
sed -i '4,7d' /tmp/testout.log
sed -i 's|^.*time=||' /tmp/testout.log
sed -i 's|\ ms||' /tmp/testout.log
sed -i 's|\..*||' /tmp/testout.log
linetotal=0
while read line
do
linetotal=$(($linetotal + 1))
done < /tmp/testout.log
SUM=0
while read line
do
SUM=$(($SUM + $line))
done < /tmp/testout.log
final=$(($SUM / $linetotal))
if (("$final" > "900")); then
exit 1
else
exit 0
fi