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

9.8.2.1 Use variable to toggle task planification

Imagine that a task (`task1') must be run every monday unless a condition is not statisfied.

First, we will create the referential and the task. va is used to create a variable named `exec_task' which value is `YES' or `NO' :

 
$ dio87d -d
$ dio87c va exec_task YES
$ dio87c ra my_ref
$ dio87c rta my_ref task1

Then, we create two operations for `task1' : a first operation to add every monday (`rtoa ... add day_of_week 2') and a second to remove selection if variable value is not YES (`rtoa ... remove if_not_equal exec_task YES') :

 
$ dio87c rtoa my_ref task1 add day_of_week 2
$ dio87c rtoa my_ref task1 remove if_not_equal exec_task YES 
$

If variable value is `YES', task will be selected every monday and not for other days :

 
$ dio87c vsv exec_task YES 
$
$ dio87c rs my_ref "2004-03-22"
task1
$ dio87c rs my_ref "2004-03-23"
$

If variable value is `NO', task will never be selected :

 
$ 
$ dio87c vsv exec_task NO 
$
$ dio87c rs my_ref "2004-03-22"
$ dio87c rs my_ref "2004-03-23"
$

You can use vi command to print variable information. In our example, you can see that `exec_task' variable is used by a rule (`Linked Rules:1').

 
$ dio87c vi exec_task
Variable name:      exec_task
Value:              NO
Linked Rules:       1
Linked Conditions:  0
$



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