1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-04 17:47:26 +03:00
Stefan Metzmacher 179c098e86 server: start with disabled interfaces and let the event scripts enable the interfaces explicit
This makes sure that we don't get public addresses assigned during the
initial recovery and remove them again in the startup event.

metze

(This used to be ctdb commit f872e8c63a2f8979e6a0d088630575bdd4d7b4f1)
2010-01-20 11:11:01 +01:00

90 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
# event script for 'make test'
cmd="$1"
shift
case $cmd in
monitor)
echo "monitor event"
echo "monitor event stderr" >&2
exit 0
;;
startrecovery)
echo "ctdb startrecovery event"
exit 0;
;;
init)
echo "ctdb init event"
exit 0;
;;
startup)
echo "ctdb startup event"
IFACES=`ctdb ifaces -Y | grep -v '^:Name:LinkStatus:References:'`
for I in $IFACES; do
IFACE=`echo -n "$I" | cut -d ':' -f2`
ctdb setifacelink $IFACE up
done
exit 0;
;;
takeip)
if [ $# != 3 ]; then
echo "must supply interface, IP and maskbits"
exit 1
fi
iface=$1
ip=$2
maskbits=$3
[ `id -u` = 0 ] && {
/sbin/ip addr add $ip/$maskbits dev $iface || {
echo "Failed to add $ip/$maskbits on dev $iface"
exit 1
}
}
exit 0;
;;
##################################################
# called when ctdbd wants to release an IP address
releaseip)
if [ $# != 3 ]; then
echo "must supply interface, IP and maskbits"
exit 1
fi
iface=$1
ip=$2
maskbits=$3
[ `id -u` = 0 ] && {
/sbin/ip addr del $ip/$maskbits dev $iface || {
echo "Failed to del $ip on dev $iface"
exit 1
}
}
echo "ctdb takeip event for $1 $2 $3"
exit 0
;;
recovered)
echo "ctdb recovered event"
exit 0
;;
shutdown)
echo "ctdb shutdown event"
exit 0
;;
stopped)
echo "ctdb stopped event"
exit 0
;;
esac
echo "Invalid command $cmd"
exit 1