Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Excerpt

JobScheduler can monitor file creation , file deletion, file changes and timestamp changes (aka file events) with a (standalone) job and with an order (and a job chain).

In this article the directory monitoring using a standalone job is described.
For further information on how to use file watching with a job chain we recommend reading Directory Monitoring with File Orders.

...

This job will monitor the folder c:/temp on a Windows® operating system. The regular expression is used to define which file(s) JobScheduler has to watch. In this example the regular expression means that every event involving the files file1.xml and/or file2.xml will fire the execution of the embedded script (which in this case will echo values for JobScheduler environment variables to stdout).

Every change of files For each new file in the folder c:/temp which is matched by the filter ^file1\.xml$ starts a task for the job.

...

Note that this behaviour could be critical when two files (e.g. file1.xml and file2.xml) are changed created at the same time.

  • Two tasks will then be started for the job.
  • In the first task the environment variable SCHEDULER_TASK_TRIGGER_FILES will have the value c:/temp/file1.xml;c:/temp/file2.xml.
  • In the second task the environment variable SCHEDULER_TASK_TRIGGER_FILES will have a value that depends on what the first task has done with the files.
  • If, for example, the first task deletes the files in c:/temp then SCHEDULER_TASK_TRIGGER_FILES will be empty for the second task.

...