On Sun, Jan 01, 2006 at 01:50:58AM +0000, Karl O. Pinc wrote: > man 5 ifstated.conf says: > > "The init block is used to initialise the state and is executed each > time the state is entered." > > But this does not seem to be true if you use 'init-state' to enter the > state. Or maybe there's something else wrong with my config below, or > with ifstated when there's no body. Or something. > > Odd things happen with the following ifstated.conf. It just hangs out > in the state "starting". (Starting the daemon by hand after booting.) > Things go back in sync after a state change on carp0. (carp0 starts > out in MASTER. Unpugging the cable sends it into BACKUP. At that > time ifstated first changes state to 'master', and then immediately to > 'not_master'.) > > OTOH, the given config works just fine if you remove the "init {" and > "}" from the "starting" state, leaving the action as the body of the > "starting". I would expect the opposite, that without "init" the > state would stay in "starting" and have to wait for a state change > before the body was evaluated. > > So, it seems that ifstated with "init-state" executes the body of the > inital state on startup, and ignores the "init" block.
The BNF seems to indicate that what you are trying to do is legal syntax-wise. At one point I had an ifstated.conf that did something similiar with a master "switch state" that was the target of init-state -- it would help determine what the correct initial state of ifstated was. I believe I tried to use 'set-state' in the init block there but don't recall it working. I've since stopped trying to do set-state in init as this does not seem like what init was intended for. Typically all I do in init states is execute something -- send an email or make a call to ifconfig (as the example ifstated.conf shows). my $.02, -jon