forked from samba-team/samba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
10.external
51 lines (39 loc) · 976 Bytes
/
10.external
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
# Eventscript for CTDB to cope with externally managed public IP addresses
# If DisableIPFailover is set:
#
# * 10.interface must be disabled.
# * For connection tracking/killing to work this script must be enabled.
[ -n "$CTDB_BASE" ] || \
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
. "${CTDB_BASE}/functions"
loadconfig
if [ -z "$CTDB_PUBLIC_ADDRESSES" ] ; then
exit 0
fi
if [ ! -f "$CTDB_PUBLIC_ADDRESSES" ] ; then
if [ "$1" = "init" ]; then
echo "No public addresses file found. Nothing to do for 10.interfaces.external"
fi
exit 0
fi
takeover_assigned_ips ()
{
_pnn=$(ctdb_get_pnn)
$CTDB -X ip |
awk -F'|' '{print $2}' |
while read ip ; do
_ip_details=$(ip_maskbits_iface "$ip")
if [ -n "$_ip_details" ] ; then
echo "Assigning $ip to this node (${_pnn})"
$CTDB moveip "$ip" "$_pnn"
fi
done
}
ctdb_check_args "$@"
case "$1" in
startup)
takeover_assigned_ips
;;
esac
exit 0