Embedded Linux Ping Script

Embedded Linux Ping Script


The follow is a short bash script for use on Linux to ping a network connection. It will either return success or an error code depending on whether or not the network connection has a reachable destination.


#! /bin/sh


## Ping with a 1 second timout in quiet mode and only ping once

if ( /bin/ping -q -c 1 -W 1 "$1" >> /dev/null ); then

exit 0

else

exit 1

fi



ClassyBits 2016