-
-
Save eckardt/c9959a87a536bdc8a963 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto eth0 | |
iface eth0 inet static | |
address 10.0.1.2 | |
netmask 255.255.255.0 | |
up /../ucarp_up_down.sh | |
down /../ucarp_up_down.sh | |
ucarp-vid-0 3 | |
ucarp-vip-0 10.0.1.3 | |
ucarp-password-0 badpasswd | |
ucarp-vid-1 10 | |
ucarp-vip-1 10.0.1.10 | |
ucarp-password-1 badpasswd | |
iface eth0:ucarp:0 inet static | |
address 10.0.1.3 | |
netmask 255.255.255.0 | |
iface eth0:ucarp:1 inet static | |
address 10.0.1.10 | |
netmask 255.255.255.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
/sbin/ifdown $1:ucarp:$3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
/sbin/ifup $1:ucarp:$3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
UCARP=/usr/sbin/ucarp | |
EXTRA_PARAMS="-x $IF_ALIAS" | |
if [ ! -x $UCARP ]; then | |
exit 0 | |
fi | |
if [ -z "$IF_UCARP_UPSCRIPT" ]; then | |
IF_UCARP_UPSCRIPT=/../ucarp-vip-up | |
fi | |
if [ -z "$IF_UCARP_DOWNSCRIPT" ]; then | |
IF_UCARP_DOWNSCRIPT=/../ucarp-vip-down | |
fi | |
if [ -n "$IF_UCARP_MASTER" ]; then | |
if ! expr "$IF_UCARP_MASTER" : "no|off|false|0" > /dev/null; then | |
EXTRA_PARAMS="$EXTRA_PARAMS -P" | |
fi | |
fi | |
if [ -n "$IF_UCARP_ADVSKEW" ]; then | |
EXTRA_PARAMS="$EXTRA_PARAMS -k $IF_UCARP_ADVSKEW" | |
fi | |
if [ -n "$IF_UCARP_ADVBASE" ]; then | |
EXTRA_PARAMS="$EXTRA_PARAMS -b $IF_UCARP_ADVBASE" | |
fi | |
# Allow logging to custom facility | |
if [ -n "$IF_UCARP_FACILITY" ] ; then | |
EXTRA_PARAMS="$EXTRA_PARAMS -f $IF_UCARP_FACILITY" | |
fi | |
if [ "$MODE" -eq "start" ] ; then | |
START_STOP_ARGS="-b -m -S" | |
elif [ "$MODE" -eq "stop" ] ; then | |
START_STOP_ARGS="-K" | |
fi | |
# Modified to use start / stop /daemon | |
if [ -n "$IF_UCARP_VID" -a -n "$IF_UCARP_VIP" -a | |
-n "$IF_UCARP_PASSWORD" ]; then | |
start-stop-daemon $START_STOP_ARGS -p "/var/run/ucarp.$IF_UCARP_VIP.pid" -x $UCARP -- -i $IFACE -s $IF_ADDRESS -z | |
-v $IF_UCARP_VID -p $IF_UCARP_PASSWORD -a $IF_UCARP_VIP | |
-u $IF_UCARP_UPSCRIPT -d $IF_UCARP_DOWNSCRIPT | |
$EXTRA_PARAMS | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
UCARP_PARAMS=( IF_UCARP_UPSCRIPT IF_UCARP_DOWNSCRIPT IF_UCARP_MASTER IF_UCARP_ADVSKEW IF_UCARP_ADVBASE IF_UCARP_FACILITY IF_UCARP_VID IF_UCARP_VIP IF_UCARP_PASSWORD ) | |
VIDS=( $( compgen -v IF_UCARP_VID ) ) | |
for UCARP_VID in "${VIDS[@]}" ; do | |
IFS="_" read -ra PARTS <<< "${UCARP_VID}" | |
IF_ALIAS=${PARTS[3]} | |
for PARAM in "${UCARP_PARAMS[@]}" ; do | |
PARAM_ALIAS="${PARAM}_${IF_ALIAS}" | |
eval ${PARAM}=\${${PARAM_ALIAS}-""} | |
done | |
source ucarp_start_stop.sh | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment