#!/bin/bash
# If network breaks down every now and then this script might keep connection alive by pinging
# your network. Add it to crontab (crontab -e as root)
# * * * * * /usr/local/Repetier-Setup/bin/pingAlive

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
. ../etc/server.conf

haswlan=$(ifconfig | grep $WLAN)
if [ "$haswlan" != "" ] ; then
  NETWORK=$(nmcli dev show wlan0 | grep "IP4.ADDRESS\[1\]" | sed 's/,//'g | awk ' { print $4 }')
  fping -a -c 1 -q -g $NETWORK 2> /dev/null
fi
