8.3.1 Monitor file (event monitor item)
- Organization of this subsection
-
(1) Overview of the function
This item monitors file status.
(2) List of settings
Name |
Required |
Format |
Can specify inherited information? |
---|---|---|---|
File name to be monitored |
Yes |
String (1 to 255 bytes)
|
Yes |
Monitoring condition |
Yes |
Combo box (Create, Delete, Change final write time, or Change size) |
No |
Timeout period(min.) |
No |
Numeric (0 to 1440) |
No |
Virtual user name |
No |
String (0 to 512 bytes) |
Yes (The profile information cannot be specified.) |
(3) Settings
- File name to be monitored
-
Specify the name of the file to be monitored.
- Monitoring condition
-
Specify the monitoring conditions. The condition is met when the status of the monitored file changes to the one specified for this setting.
- Timeout period(min.)
-
Specify the timeout period for the file monitor. If omitted or set to 0, the file monitor is not terminated.
When the timeout period is reached, the monitor ends abnormally (ENDE).
- Virtual user name
-
Specify the name of the virtual user mapped to the name of the Windows user who executes the item. If the virtual user name is omitted, the item is executed with the account for the CPA job execution service.
To map the virtual user name, use the cpasetumap command. For details on the cpasetumap command, see cpasetumap in 9. Commands.
(4) Return values
Value |
Description |
---|---|
-1 |
Forced termination. |
0 |
One of the following cases:
|
2 |
Insufficient resources or high processing load.
|
3 |
System call failed.
|
4 |
An incorrect value was specified.
|
(5) Example 1
Detect an event when a certain file is created.
File name to be monitored |
c:\temp\a.txt |
Monitoring condition |
Create |
(6) Example 2
Monitor updates of multiple files at a time
File name to be monitored |
c:\temp\*.txt |
Monitoring condition |
Change final write time |
(7) Understanding when monitoring conditions are met
The file monitor obtains the status of the monitored file every 60 seconds, and compares the file status. When the file monitor finds a change that satisfies the monitoring conditions, it compares the status again 10 seconds later to check whether the update of the monitored file is completed. If no change is found in the monitored file at the time, then the file monitor detects the event. Thus, it can take up to 70 seconds from when the monitored file is changed until the event is detected. For deletion, it can take up to 60 seconds because the second comparison is not performed.
Suppose that monitoring starts without there being any monitored file and with Change final write time or Change size specified as a monitoring condition. In this case, even when a monitored file is created, the event is detected assuming that the monitoring condition has been met.
(8) Monitoring intervals
As the file monitor checks the file status every 60 seconds, it obtains only the latest status if the monitored file has been changed multiple times within 60 seconds. For example, suppose you select Create for Monitoring condition. If a monitored file is created and immediately deleted within 60 seconds, the file monitor cannot find the file, and thus cannot detect it as an event.
(9) Files to be monitored
Files are monitored by using the account of the user who is logged on to the CPA job execution service. This means that when the default local system account is used to log on to the job execution service, only local files can be monitored (network files cannot be monitored).
(10) When specifying monitored files with wildcards
If monitoring is performed for the files specified with wildcards, only one event is raised regardless of how many files meet the condition.
If more than 10 files meet the condition, only the first 10 files are processed for event detection and other subsequent files are not processed. That is, the information of the subsequent files is not included in the inherited information. For details on inherited information, see 5.5.2 Inherited information. In addition, short file names are also monitored.
(11) If files already exist when monitoring starts
When the file monitor job starts with Monitoring condition set to Create, it detects events even if the monitored files already exist.