Technical information

thumbnail - monitor folders

Just Information

Please note that all info on this page is highly technical and not needed if you just want to use watchDirectory. It is meant as background information for those interested.

Work in Progress

This page is not complete yet, but may be interesting for our customers. In the near future there will be more pages with this kind of background information.

Introduction

WatchDirectory consists of several main programs:

  • The WatchDirectory Control Center (wdcc.exe)
    This program is used to configure WatchDirectory, create, change, start and stop tasks.
  • The Postman program (wdPostman.exe)
    This program handles all email sending.
  • The Task History program (history.exe)
    This program shows you all messages generated by your tasks.
  • The WatchDirectory task runner (wdrun.exe)
    This is the program that actually monitors directories and runs your configured tasks. The wdrun program is the main subject of this page.

Furthermore, WatchDirectory has a lot of plugins, implemented as DLL files (dynamic link libraries). These plugins all have their own specialized function. For example, there is a plugin to send email, another one to copy files etcetera.

Files used and created by wdrun

Input files read by wdrun - the Task Runner

Task Directory

The Task directory is typically located here:
C:\Documents and Settings\All Users\Application Data\watchDirectory
But the exact location depends on your operating system. Also, when you first started the watchDirectory Control Center, you were given the option to choose another location for this directory.
If you want to explore this directory, choose the "Tools -> Explore Task Directory" menu option inside the watchDirectory Control Center.
A previous newsletter shows how to change the task directory.

The most important file used by wdrun.exe is the task configuration file. This is the file that stores all the settings for the task. For example it stores the directoryname that should be monitored and what plugin to load. This file is stored in your task directory (see sidebar).
The name of this file is <TaskName>.config, where <TaskName> is the name you gave your task. So, if your task is called AutoEmail, its config file will be called AutoEmail.config.
These config files are "plain text" in Windows .ini format. Please be careful if you edit these files yourself!

Another file read by wdrun is the watchDirectory.ini file that is stored in its install directory (typically C:\Program Files\watchDirectory). This file has only one setting: the location of the Task directory. This setting is needed to find out where the config file for the task to run is stored.

The last file read is synchpoint.txt. If you have configured your task to "check for missed events", this file stores a timestamp of the last detected event. When the task starts up, it checks the directory for any files created/updated after this timestamp.

Output files written by wdrun - the Task Runner

The most important file written to by the Task Runner is the history database of the task. This is a relational SQLite database that stores all messages for the task. You use the Task History viewer to browse the contents of this file. The history.db file itself is stored inside a sub-directory of the Task Directory (see sidebar). If your task is called AutoCopy, its history database is typically

C:\Documents and Settings\All Users\Application Data\watchDirectory\AutoCopy\history.db

The plugin that is loaded by wdrun can also create files, but that depends on the configured plugin.

The Task Runner Threads

wdrun is a so called multithreaded program, meaning that it can do several things simultanuously on multi-cpu or multi-core computers. Even if you run on a single processor computer, a multithreaded program has advantages. When one of the threads of the program is blocked by Windows (for example, it is reading a very slow network file), the other threads can continue to run. If a program is not multithreaded, it would block completely.

The directory monitor thread

This thread does the actual monitoring (watching) of the directory. Everytime it detects a change (a new, deleted, renamed or modified file or directory) it checks this change against the events, event filters and ignored directories you configured and, if those settings allow it, queues the event so another thread can handle it.
The directory monitor thread uses the settings of the Monitoring Method page to determine how it should monitor the directory.

The Task Caller thread

To be continued...


German Website deutschsprachige Webseite      French Website French Language Website      Spanish Website Spanish Language Website