Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Mar 2007 09:42:34 -0300
From:      "Alexandre Biancalana" <biancalana@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: ifstated check commands behavior
Message-ID:  <8e10486b0703150542v3c5d018chde2c1ad5f8ba09ec@mail.gmail.com>
In-Reply-To: <8e10486b0703141137rde7b516ufb14f06221792c65@mail.gmail.com>
References:  <8e10486b0703141137rde7b516ufb14f06221792c65@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 3/14/07, Alexandre Biancalana <biancalana@gmail.com> wrote:
>
> Hi list,
>
>   I'm trying to setup ifstated to check two links and if some go down, do
> some actions like change pf rules and machine's route.
>
>   My doubt is about the execution order/repetition of the states body of
> ifstated.conf, in all configs that I tried just the last check is executed
> always, follow and example:
>
> ifstated.conf:
> ==============================
> loglevel debug
>
> ping1 = '( "ping -q -c 1 -t 3 www.site1.com > /dev/null" every 10 ) '
> ping2 = '( "ping -q -c 1 -t 3 www.site2.com > /dev/null" every 10 ) '
>
> state one {
>         if ! ( $ping1 && $ping2 ) {
>                 set-state two
>         }
> }
>
> state two {
>
>         init {
>                 run "logger -p console.notice -t ifstated 'Restarting
> network !'"
>         }
>
>         if ( $ping && $ping2 ) {
>                 set-state one
>         }
> }
>
> ==============================
>
> # ifstated -dv
> ping1 = "( "ping -q -c 1 -t 3 www.site1.com > /dev/null" every 10 ) "
> ping2 = "( "ping -q -c 1 -t 3 www.site2.com > /dev/null" every 10 ) "
> ifstated: initial state: one
> ifstated: changing state to one
> ifstated: running ping -q -c 1 -t 3 www.site1.com > /dev/null
> ifstated: running ping -q -c 1 -t 3 www.site2.com > /dev/null
> ifstated: started
> ifstated: changing state to two
> ifstated: running ping -q -c 1 -t 3 www.site1.com > /dev/null
> ifstated: running ping -q -c 1 -t 3 www.site2.com > /dev/null
> ifstated: running ping -q -c 1 -t 3 www.site2.com > /dev/null
> ifstated: running ping -q -c 1 -t 3 www.site2.com > /dev/null
>
>
> As you can see, after change state ifstated execute only the *last* check
> command of the statement (ping2) forever....
>
> This is the expected behavior ?



This shouldn't execute all state body until state change  ??



Thanks for any help.

Alexandre



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8e10486b0703150542v3c5d018chde2c1ad5f8ba09ec>