The ctmfw Command in Control-M | Generated by AI
The ctmfw
command in Control-M is part of the File Watcher utility, used to monitor files for events like creation, deletion, or transfer completion. The specific command ctmfw %%FILENAME CREATE 0 60 10 3 1410
can be broken down based on the parameters defined in the Control-M documentation. Here’s what each part means:
-
ctmfw
: The Control-M File Watcher utility, which detects file-related events and triggers actions based on conditions, such as starting a job or executing a command. -
%%FILENAME
: A variable representing the name or path of the file to monitor (e.g.,datafile.txt
or a pattern like*.csv
). The actual file name is resolved at runtime, typically defined in the Control-M job or environment. -
CREATE
: The mode of operation, indicating the utility is watching for the creation of the specified file. Other possible modes includeDELETE
for monitoring file deletion. -
0
: The minimum file size (in bytes) required for the file to be considered valid. A value of0
means any file size is acceptable, so the utility will detect the file regardless of its size. -
60
: The interval (in seconds) between successive attempts to check for the file’s existence. The utility checks every 60 seconds to see if the file has been created. -
10
: The interval (in seconds) between attempts to monitor the file size after the file is detected. This ensures the file size is stable (not still being written). The utility checks the file size every 10 seconds. -
3
: The number of iterations where the file size must remain static (unchanged) to confirm the file is fully created. The utility checks the file size 3 times (at 10-second intervals, totaling 30 seconds) to ensure it’s stable. -
1410
: The maximum time (in minutes) the utility will run while waiting for the file to be created and meet the size criteria. 1410 minutes equals approximately 23.5 hours. If the file isn’t detected or doesn’t stabilize within this time, the utility times out and may execute aDO_NOTOK
action (e.g., report “FILE WAS NOT CREATED”).
How It Works
This command monitors for the creation of a file specified by %%FILENAME
. It checks every 60 seconds for the file’s existence. Once detected, it verifies the file size remains unchanged for 3 iterations of 10 seconds each (30 seconds total). The process will continue for up to 1410 minutes (23.5 hours) or until the file is detected and stable. If the file is created and meets the criteria, a DO_OK
action (e.g., triggering a job or command) is executed. If not, a DO_NOTOK
action is performed.
Example Scenario
If %%FILENAME
is set to /home/controlm/datafile.txt
, the utility:
- Checks every 60 seconds for
datafile.txt
. - Once found, ensures its size is stable for 30 seconds (3 checks at 10-second intervals).
- Runs for up to 23.5 hours or until the file is stable.
- If successful, it might trigger a job (e.g., moving the file to another directory). If it times out, it might log “FILE WAS NOT CREATED”.
Notes
- The
%%FILENAME
variable must be defined in the Control-M job or environment, or the command will fail. - The utility ignores files with a modification time older than 50 years.
- If wildcards are used in
%%FILENAME
(e.g.,*.csv
), additional parameters likeMONITOR_FILE_SIZE
may be needed to handle multiple files. - For cyclic monitoring (repeated checks after detection), a
CYCLIC_INTERVAL
parameter would be required, but it’s not specified here.
This explanation is based on Control-M File Watcher documentation from sources like BMC’s official documentation and community discussions.