
#!/bin/sh
# File	: chk_gw_and_restart_nw.sh
# By	: MaartenDeBoer.nl, 170704
# Subject	: Script to check GW otherwise restart networking
PGM="`basename $0|cut -d\.`"

GW="192.168.178.1" 

ping -W 1 -c 1 ${GW}
EC=${?}

echo ${EC}
if [ ${EC} -ne 0 ]; then
  echo "  No GW ping. Restarting networking ..." 
  sudo /etc/init.d/networking restart

fi

exit 0

