jeudi 8 novembre 2018

Ping check

!/bin/bash

PINGLAT=$(ping -c1 8.8.8.8 | grep -i time | head -n 1 | awk '{print $7}' | awk 'BEGIN {FS="[=]|[ ]"} {print $2}')
PINGTHRESHOLD=400
PINGLATINT=$(echo "$PINGLAT/1" | bc)

echo $PINGLATINT

if [ $PINGLATINT -gt $PINGTHRESHOLD ]
 then play -q ~jdoe/Musique/bip.mp3
 else exit 0
fi

Aucun commentaire: