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

9.13.2 File condition

With a file condition, a task waits for a file presence. The file presence test is done on the server which is represented by the target of the task. If the target of the task is not specifed, the file presence test is done on the server where `dio87d' is running.

In this example, we will create a target `remote_server' with a queue `batch'.

 
$ dio87c ta remote_server
$ dio87c qa remote_server batch
$

With the tsh, we specify the hostname or the IP address of the remote computer. If you don't have a remote server where a `dio87d' daemon is running, you can use `localhost' as hostname.

 
$ dio87c tsh remote_server localhost
$ dio87c tsh remote_server localhost

Now, we create a referential `r1' with a task `t1' and we add an `add always' operation to this task to select it automatically when a day is created. Then we link the `t1' task with the `remote_server' target :

 
$ dio87c ra r1
$ dio87c rta r1 t1
$ dio87c rtoa r1 t1 add always
$ dio87c rtst r1 t1 remote_server
$

Now, we must create the file condition to force the task to wait the presence of the file `/tmp/ftop_1'. We use the rtca command :

 
$ dio87c rtca r1 t1 file "/tmp/ftop_1"
$
$ dio87c rtcc r1 t1
1
$
$ dio87c rtcl r1 t1
file	/tmp/ftop_1
$

We use the rtcc command to print the number of conditions of the task `t1' and we print the condition list with the rtcl.

We create a new day `d1' :

 
$ dio87c rp r1 "2004-11-04" d1 
$

We print the state of the task with the xtl -s command and the list of conditions of the task with the xtcl -s command :

 
$ dio87c -- xtl -s d1
t1      wait_for_condition
$
$ dio87c -- xtcl -s d1 t1
file    /tmp/ftop_1      waiting
$

Now, we will create the `/tmp/ftop_1' file. This file must be created on the server specified by the `remote_server' target.

 
$ touch /tmp/ftop_1
$
$ dio87c -- xtcl -s d1 t1
file    /tmp/ftop_1     waiting
$
$ dio87c -- xtcl -s d1 t1
file    /tmp/ftop_1     finished
$
$ dio87c -- xtl -s d1
t1      terminated
$

After few seconds, the file presence is detected. Then, the condition is validated (`finished') and the task can run.

It's possible to add more than one `file' condition to a task. In this case, the task will wait until all files are present.

A file condition can be combinated with other types of conditions. For example, a `hmax' condition will be used to start task execution at a specified time, even if the file is not present.

On the contrary, a `hlate' condition will be used to cancel task execution if the file is not present at a specified time.


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

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