# This is the only difference between the primary and secondary
# HAST node. Set it accordingly.
init-state primary
#init-state secondary

# Leave it or substitute "carp0" for the name of your CARP interface
# if it varies.
carp_up = "carp0.link.up"
carp_down = "!carp0.link.up"

# The "net" address is an address which can be used to determine
# whether we have connectivity. Make sure the host is always up, or
# test multiple ip's, 'or'-ing the tests.
net = '( "ping -q -c 1 -W 1000 10.11.12.13 > /dev/null" every 10)'

state primary {
        init {
                # Leave it or substitute "carp0" for the name of
                # your CARP interface if it varies.
                run "ifconfig carp0 advskew 10"
                # Where your carp-hast-switch resides...
                run "/root/bin/carp-hast-switch master"
        }
        if $carp_down || ! $net
                set-state secondary
}

state secondary {
        init {
                # Leave it or substitute "carp0" for the name of
                # your CARP interface if it varies.
                run "ifconfig carp0 advskew 100"
                # Where your carp-hast-switch resides...
                run "/root/bin/carp-hast-switch slave"
        }
        if $carp_up && $net
                set-state primary
}


Reply via email to