<div dir="ltr">And I tried to be too smart, and wrote a script that will notify me on my Gmail account.<br><br>But, I forgot to run it with nohup, so it aborted and was not running to inform anyone ...<br><br><br>#!/bin/sh<br>
<br>MAIL=<a href="mailto:yourmail@gmail.com">yourmail@gmail.com</a><br>HOST=1.1.1.1 # Your external IP address<br><br>PING_SECS=60<br>PING_CHECK_COUNT=5<br><br>PING_FAIL_COUNT=0<br>while true<br>do<br>  sleep $PING_SECS<br>
<br>  fping -q $HOST<br>  if [ "$?" != 0 ]; then<br>    PING_FAIL_COUNT=`expr $PING_FAIL_COUNT + 1`<br>  else<br>    # Reset the counter<br>    PING_FAIL_COUNT=0<br>  fi<br><br>  # If ping fails for 5 times in a row, notify <br>
  if [ $PING_FAIL_COUNT -gt $PING_CHECK_COUNT ]; then<br>    echo "$PING_CHECK_COUNT consecutive failures ... sending notification!"<br>    mail -s "Internet is not working!" $MAIL <<EOF<br>The internet connection is not working.<br>
<br>Inform your techie-in-residence now!<br>Make sure you inform them verbally, in person, NOT by <br>email, and not by a VoIP line.<br>EOF<br>    echo "Notification sent. Exiting!"<br>    exit<br>  fi<br>done<br>
</div>