On this Page

    -FMScript

    (As of 3.1.001.10)

    Identifies an override script to be run when the FolderMonitor instance itself starts and stops. That is, this is not on a per job basis, but for an entire run of a FolderMonitor instance.

    Syntax

    -FMScript scriptName

    Description

    FolderMonitor, by default, runs script $E/Default-FMScript.wjs when it starts and when it ends. This -FMScript option allows you to specify an alternative script to be run at those times. The scriptName must include path information. Typically it would be $O/FMScript.wjs.

    When the script is invoked it is provided with an _fm  object which contains the command line options and a set of statistics that may be of interest to the script writer. Please read the comments in $E/Default-FMScript.wjs.

    The statistics that are supplied in the _fm object are:

    Property

    Description

    StartTime

    When the FM instance started, in seconds since Jan 1, 1970.

    EndTime

    When the FM instance ended, in seconds since Jan 1, 1970. This is 0 when the script is called at the start of an FM instance.

    PassJobs

    The number of jobs that were processed successfully.

    FailJobs

    The number of jobs that failed, and hence were copied to the error folder.

    Quarantined

    If FM encounters a job but cannot get read access to it, it quarantines that file. It will retry the file from time to time. This statistic gives the number of files that were still in quarantine when FM was about to end.

    Pauses

    FM will continue processing jobs until all its queues are empty. At that time it will pause for the time specified by the -pause option. This statistic identifies the number of times that FM paused because it had no jobs to do. You might use this statistic to judiciously adjust your -pause time.

    RC

    This is the return code that FM is about to exit with.

    The above properties can be accessed case-insensitively. (Unusual for JavaScript.)

    See Also

    Command Line Processing
    Command Options - FolderMonitor