/usr/share/doc/ifupdown/examples/ping-places.sh is in ifupdown 0.7.47.2ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #!/bin/sh
if [ `id -u` -ne 0 ] || [ "$1" = "" ]; then exit 1; fi
if [ -x /usr/bin/fping ]; then
PING="/usr/bin/fping"
else
PING="/bin/ping -c 2"
fi
iface="$1"
which=""
while read addr pingme scheme; do
if [ "$which" ]; then continue; fi
#echo " Trying $addr & $pingme ($scheme)" >&2
ip addr add $addr dev $iface >/dev/null 2>&1
ip link set $iface up >/dev/null 2>&1
if $PING $pingme >/dev/null 2>&1; then
which="$scheme"
fi
ip link set $iface down >/dev/null 2>&1
ip addr del $addr dev $iface >/dev/null 2>&1
done
if [ "$which" ]; then echo $which; exit 0; fi
exit 1
|