GZProMon™
A command line process monitor for Windows

Purpose

GZProMon is a command line process monitor for Windows. Its job is to examine the Windows running processes list to see whether a given executable is running. If it is, GZProMon can sleep for a configurable interval and check again. This polling process can be repeated a configurable number of times before GZProMon exits.

The primary use for GZProMon is in an ACM task list where some process has been spawned off asynchronously (using the trailing & on the parameters). If the task list must then wait until this process completes, then it can use GZProMon at the end of the task list to do so.

Command Format

The line command is of the following generic form:

gzpromon process-list <options>
where

process-list
is the list of processes to examine. This can be a single process executable name, e.g. myapp.exe, or a list of two or more processes separated by commas, e.g. myapp1.exe,myapp2.exe. Note that the executable names are not case-sensitive.

options is a set of zero or more options or switches. Each option is preceded by a slash (/) or dash (-). The order of options is unimportant.

The command will complete when all the processes in the process list have been found to be not running or the timeout limit has been reached. In the former case, GZProMon will exit with a completion code of zero (0). In the latter, it will exit with code one (1). Note that the /run option inverts the completion logic so that a zero return code indicates all processes are still running.

Options

This is the list of options which may appear on the command line after the process list. Options may have parameters. If so, an equal sign separates the option from its parameters. No spaces can appear around the equal sign.

Option Values Default Notes
/run None N/A Inverts the monitor logic. The command exits when all processes are running.
/initwait=nn Any number 0 Initial wait interval in seconds. GZProMon does not make its first check of the running processes list until after this interval has expired.
/nextwait=nn Any number 5 or /initwait Subsequent wait intervals (in seconds) between checks of the running processes list. The default is 5 seconds, unless the /initwait option has been coded, in which case that value is used.
/retries=nn Any number 0 Number of times the process list check will be retried after the initial check. The default is zero, meaning that the list will only be checked once. If greater than zero, then GZProMon sleeps for /nextwait seconds.
/quiet None N/A No messages are to be written to stdout.

Exit Codes

GZProMon exits with zero when the monitoring condition is met, i.e. when all processes are not running (by default) or when all processes are running if the /run option is used. If the condition is not met, it exits with code of one.

Example

Consider this command:

gzpromon myapp1.exe,myapp2.exe /initwait=30 /nextwait=10 /retries=5

This will wait for two programs, MYAPP1 and MYAPP2, to complete. No check of the process list will be done for 30 seconds. GZProMon will pause for 10 seconds between each check. There will be five retries or a total of 6 checks before exiting with exit code one. The maximum length of time allowed by this command for these two programs to finish is 80 seconds (5x10 + 30).

Sample Output

If the above example command were issued, GZProMon might return messages like those below. (In an ACM task list, this output can only be seen by redirecting stdout.)
G&Z Process Monitor - Ver. 1.01 - 09/14/01 07:30
Sleeping for initial wait of 30 seconds...
Reading Windows process list...
Found target process: myapp1.exe
Found target process: myapp2.exe
Processes scanned: 151; found 2; not found 0
Sleeping for next wait interval of 10 seconds...
Reading Windows process list...
Found target process: myapp1.exe
Processes scanned: 151; found 1; not found 1
Sleeping for next wait interval of 10 seconds...
Reading Windows process list...
Processes scanned: 151; found 0; not found 2
Process monitoring complete; exit code is 0

Note that by using the /quiet option, none of the above would appear.



All product and service names listed on this and any other pages of this site are either registered trademarks or service marks or common law trademarks or service marks of Computer Associates International, Inc., or G & Z Systems, Inc.,. All other product names referenced herein are trademarks or service marks of their respective companies.

No HOME button on the left side of your page?
Click here for Our
Home Page