master
bryan 2020-12-28 03:41:37 +00:00
parent 6dd9959a4d
commit f20e704efc
1 changed files with 7 additions and 5 deletions

View File

@ -22,15 +22,15 @@ alert() {
#stdbuf -oL arping "$IP" | while read line #stdbuf -oL arping "$IP" | while read line
while read line while read line
do do
echo "$line" #echo "$line"
if [ "$line" = "Timeout" ]; then if [ "$line" = "Timeout" ]; then
if [ "$startedTimeout" = "n" ]; then if [ "$startedTimeout" = "n" ]; then
startedTimeout="y" startedTimeout="y"
counter=1 counter=1
echo "$counter" #echo "$counter"
else else
let "counter += 1" let "counter += 1"
echo "******** $counter" #echo "******** $counter"
if [ $counter -eq $countToAway ]; then if [ $counter -eq $countToAway ]; then
alert "$ALERT_TITLE" "$ALERT_MESSAGE_AWAY" alert "$ALERT_TITLE" "$ALERT_MESSAGE_AWAY"
alertedHome="n" alertedHome="n"
@ -39,9 +39,11 @@ do
fi fi
else else
if [ "$startedTimeout" = "y" ]; then if [ "$startedTimeout" = "y" ]; then
if [ "$counter" -ge `expr 600 / $INTERVAL` && "$counter" -le `expr 1800 / $INTERVAL ]; then if [ "$counter" -ge $((600 / $INTERVAL)) ]; then
if [ "$counter" -le $((1800 / $INTERVAL)) ]; then
echo "$counter" >> "$LOGFILE" echo "$counter" >> "$LOGFILE"
fi fi
fi
startedTimeout="n" startedTimeout="n"
counter=0 counter=0
if [ "$alertedHome" = "n" ]; then if [ "$alertedHome" = "n" ]; then