From owner-freebsd-questions@FreeBSD.ORG Thu Mar 15 12:42:39 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D67A16A403 for ; Thu, 15 Mar 2007 12:42:39 +0000 (UTC) (envelope-from biancalana@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) by mx1.freebsd.org (Postfix) with ESMTP id C859013C484 for ; Thu, 15 Mar 2007 12:42:37 +0000 (UTC) (envelope-from biancalana@gmail.com) Received: by ug-out-1314.google.com with SMTP id 71so303583ugh for ; Thu, 15 Mar 2007 05:42:35 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=o1+h7V1TU9r4Vv5DfqmO2elfscFfuqGfj4TjJoGsnqa7AltznwDrkhUvA6zPLYkUQPuR/Q4b6w+/yI/IwOiNsidm3wEHnmeg0vLuNQjsIAb6WgZ3V/xM5QRUL1N4PtytIma3qP/eWHtQgRnygb4SVlbVtW34hgi3mqvkpSnThbc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=RSWAPSGUREFJBRM50SqL+pkj/xykg3ReBQ8jrDv94QmBJ0Z+OOqcME/Tv3bXCHQb79f0Mxkn8JE76huuKG9alzdcfbBwpEWFPogrZxwLQzFS3dZEVCvo0ekNDTFhpEYXm99Fbivvw0YdrAUr7OUDhm3uXljV0PKShB67oNuSzMA= Received: by 10.78.172.20 with SMTP id u20mr332854hue.1173962555077; Thu, 15 Mar 2007 05:42:35 -0700 (PDT) Received: by 10.48.164.13 with HTTP; Thu, 15 Mar 2007 05:42:34 -0700 (PDT) Message-ID: <8e10486b0703150542v3c5d018chde2c1ad5f8ba09ec@mail.gmail.com> Date: Thu, 15 Mar 2007 09:42:34 -0300 From: "Alexandre Biancalana" To: freebsd-questions@freebsd.org In-Reply-To: <8e10486b0703141137rde7b516ufb14f06221792c65@mail.gmail.com> MIME-Version: 1.0 References: <8e10486b0703141137rde7b516ufb14f06221792c65@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: ifstated check commands behavior X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Mar 2007 12:42:39 -0000 On 3/14/07, Alexandre Biancalana 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