Skip to content

Instantly share code, notes, and snippets.

@spot62
Created May 21, 2016 08:07
Show Gist options
  • Save spot62/6a8651b7956ca7da90780a2d49d5696d to your computer and use it in GitHub Desktop.
Save spot62/6a8651b7956ca7da90780a2d49d5696d to your computer and use it in GitHub Desktop.
Checking interface working
#!/bin/bash
IFACE_NAME="p2p1"
IFACE_IP="192.168.1.1"
RES=`ping -I ${IFACE_NAME} ${IFACE_IP} -c 3 | grep "100%" |wc -l`
if ! [ ${RES} -ne "1" ];
then
echo "${IFACE_NAME} is not working"
else
echo "${IFACE_NAME} is working"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment