[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.8.3 Use variable as start condition

You can use a variable to control start of tasks. The value of a variable is compared to a specified value to decide when a task can start.

rtca command accepts two types of conditions to test variable value : `if_equal' and `if_not_equal'.

With a `if_equal' condition, task is holded until a variable value is equal to a specified value. With a `if_not_equal' condition, task is holded while a variable is equal to a specified value.

For example, imagine we want to start a task (`task1') when the value of `start_task' variable is equal to `OK'.

First, we start `dio87d', `dio87d' and `dio87d'. Then we create a referential named `my_ref' and a task `task1' in this referential :

 
$ dio87d -d
$ dio87d -d
$ dio87d -d
$ dio87d -d
$
$ dio87c ra my_ref
$ dio87c rta my_ref task1
$ dio87c rtoa my_ref task1 add always
$

We create `start_task' on each daemon (`dio87d' and `dio87d'). rtca command is used to add a start condition to `task1' : `rtca ... if_equal start_task OK'. It means that this start condition will be validated when the value of `start_task' variable will be set to `OK'.

 
$ dio87c va start_task
$ dio87c va start_task
$
$ dio87c rtca my_ref task1 if_equal start_task OK
$ 

Now we set variable value to `NO' and we create a new day `d1' :

 
$ dio87c vsv start_task NO
$ dio87c rp my_ref "2004-03-19" d1 
$ 

Since variable value is not `OK', task condition is waiting (xtcl -s) and `task1' is waiting for condition (xtl -s).

 
$ dio87c -- xtcl -s d1 task1
if_equal   start_task    OK     waiting
$
$ dio87c -- xtl -s d1
task1      wait_for_condition
$ 

To start `task1', we just have to set value to `OK' with vsv. At once, condition is validated and `task1' is running :

 
$ dio87c vsv start_task OK
$
$ dio87c -- xtcl -s d1 task1
if_equal   start_task    OK     finished
$
$ dio87c -- xtl -s d1
task1      terminated
$


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by dom on September, 11 2005 using texi2html