Process Monitor

Mirror of http://www.ironpython.info/index.php/Process_Monitor from 8/14/11 Licensed under CC BY 3.0

Original contents:


Process Monitor

The following code demonstrates how to write a small utility in IronPython that monitors a process and re-launches it if it dies.

Recommended Usage (Windows)

The recommended way to try the above code is to save it in a file named procmon.py. In the same directory as procmon.py, create a batch file called procmon.bat and place the following text in there:

This assumes that the console version of the IronPython executable (ipy.exe) is in your PATH environment variable. Next, just type procmon notepad.exe on the Command Prompt. If you close the launched Notepad instance then a new one will be launched shortly after. This will keep happening until the IronPython script is stopped by simply pressing ENTER at its console.

See also: Deployment#Batch Files

Sample Output

Below is an example of what the output from the IronPython script could look like. Notice that three question marks (???) where the owner could not be determined.

Back to Contents.


Wayback Machine link: https://web.archive.org/web/20110814083110/http://www.ironpython.info/index.php/Process_Monitor