Revision 9d7e8218 tools/master-ip-setup
b/tools/master-ip-setup | ||
---|---|---|
23 | 23 |
USAGE_MSG="Usage: $0 {start|stop}" |
24 | 24 |
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin |
25 | 25 |
|
26 |
FPING_PACKET_COUNT=1 |
|
26 |
FPING_PACKET_COUNT=5 |
|
27 |
FPING_PACKET_INTERVAL_MS=200 |
|
27 | 28 |
|
28 | 29 |
# Start the master IP |
29 | 30 |
start() { |
... | ... | |
41 | 42 |
esac |
42 | 43 |
|
43 | 44 |
# Check if the master IP address is already configured on this machine |
44 |
if fping -c $FPING_PACKET_COUNT -S 127.0.0.1 $MASTER_IP >/dev/null 2>&1; then |
|
45 |
if fping -c $FPING_PACKET_COUNT -p $FPING_PACKET_INTERVAL_MS \ |
|
46 |
-S 127.0.0.1 $MASTER_IP >/dev/null 2>&1; then |
|
45 | 47 |
echo "Master IP address already configured on this machine. Doing nothing." |
46 | 48 |
exit 0 |
47 | 49 |
fi |
48 | 50 |
|
49 | 51 |
# Check if the master IP address is already configured on another machine |
50 |
if fping -c $FPING_PACKET_COUNT $MASTER_IP >/dev/null 2>&1; then |
|
52 |
if fping -c $FPING_PACKET_COUNT -p $FPING_PACKET_INTERVAL_MS \ |
|
53 |
$MASTER_IP >/dev/null 2>&1; then |
|
51 | 54 |
echo "Error: master IP address configured on another machine." >&2 |
52 | 55 |
exit 1 |
53 | 56 |
fi |
... | ... | |
68 | 71 |
if ! ip addr show dev $MASTER_NETDEV | \ |
69 | 72 |
grep -F " $MASTER_IP/$MASTER_NETMASK" >/dev/null 2>&1; then |
70 | 73 |
# Check if the master IP address is configured on a wrong device |
71 |
if fping -c $FPING_PACKET_COUNT -S 127.0.0.1 $MASTER_IP >/dev/null 2>&1; then |
|
74 |
if fping -c $FPING_PACKET_COUNT -p $FPING_PACKET_INTERVAL_MS \ |
|
75 |
-S 127.0.0.1 $MASTER_IP >/dev/null 2>&1; then |
|
72 | 76 |
echo "Error: master IP address configured on wrong device," \ |
73 | 77 |
"can't shut it down." >&2 |
74 | 78 |
exit 1 |
Also available in: Unified diff