Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / share / doc / ifupdown / examples / | server ip : 172.67.156.115 your ip : 172.70.80.99 H O M E |
Filename | /usr/share/doc/ifupdown/examples/ping-places.sh |
Size | 605 |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 09:50 |
Last modified | 22-Jun-2012 05:52 |
Last accessed | 07-Jul-2025 00:05 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
#!/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
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