adminst
Posts: 7
Joined: Thu Feb 08, 2018 12:59 pm

Check Latency

Fri Feb 23, 2018 9:26 pm

Hi all
I've sometimes a high latency if I ping my gateway (1000ms overWLAN).
How could I check the ping latency (ms) to my host and if he's over 100ms reboot my pi?

Thx
adminst

RonR
Posts: 267
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Check Latency

Sat Feb 24, 2018 7:50 am

Try this script:

Code: Select all

#!/bin/bash

TIME=$(ping -c 1 host | sed -n 's|.*time=\(\S*\)\.\S* ms|\1|p')
if [ ${TIME} -gt 100 ]; then
  shutdown -r now
fi

Return to “Beginners”

Who is online

Users browsing this forum: Google [Bot], HawaiianPi and 27 guests