mirror of
https://github.com/samba-team/samba.git
synced 2024-12-28 07:21:54 +03:00
db25ca69e5
The functions file no longer causes a side-effect by doing a shift. It also doesn't set a convenience variable for $1. All eventscripts now explicitly use "$1" in their case statement, as does the initscript. The absence of a shift means that the takeip/releaseip events now explicitly reference $2-$4 rather than $1-$3. New function ctdb_standard_event_handler handles the status and setstatus events, and exits for either of those events. It is called via a default case in each eventscript, replacing an explicit status case where applicable. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 3d55408cbbb3bb71670b80f3dad5639ea0be5b5b)
36 lines
779 B
Bash
Executable File
36 lines
779 B
Bash
Executable File
#!/bin/sh
|
|
# script to add entries to the routing table after we have performed a
|
|
# take ip event
|
|
# (when we do a "releaseip" event and remove an ip address from an interface
|
|
# the kernel might automatically remove associated entries from
|
|
# the routing table. This is where we add them back)
|
|
#
|
|
# Routes to add are defined in /etc/ctdb/static-routes.
|
|
# Syntax is :
|
|
# IFACE NET/MASK GATEWAY
|
|
#
|
|
# Example
|
|
# bond1 10.3.3.0/24 10.0.0.1
|
|
|
|
. $CTDB_BASE/functions
|
|
loadconfig
|
|
|
|
[ -f $CTDB_BASE/static-routes ] || {
|
|
exit 0
|
|
}
|
|
|
|
case "$1" in
|
|
takeip|releaseip)
|
|
iface=$2
|
|
cat $CTDB_BASE/static-routes | egrep "^$iface " | while read IFACE DEST GW; do
|
|
ip route add $DEST via $GW dev $IFACE >/dev/null 2>/dev/null
|
|
done
|
|
;;
|
|
|
|
*)
|
|
ctdb_standard_event_handler "$@"
|
|
;;
|
|
esac
|
|
|
|
exit 0
|