/usr/share/doc/arping/examples/arping.if-up is in arping 2.14-1.
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 31 32 33 34 35 36 37 | #!/bin/sh
set -e
if [ "${IF_ADDRESS}" = "" ] ; then
exit 0
fi
. /lib/lsb/init-functions
IPUP=0
DOWN=0
if [ -f /etc/default/arping ] ; then
. /etc/default/arping
fi
if [ $IPUP = 0 ]; then
exit 0
fi
log_action_begin_msg "Using arping to check duplicity of ${IF_ADDRESS}"
if arping -c 1 -d -I ${IFACE} ${IF_ADDRESS} > /dev/null ; then
if [ $DOWN = 1 ]; then
ifconfig ${IFACE} down
msg="Bringing ${IFACE} down. "
fi
msg=${msg}"Another computer is already using ${IF_ADDRESS}"
status=1
else
msg="No duplicates found"
status=0
fi
log_action_end_msg ${status} "${msg}"
[ ${status} = 0 ]
|