Make your own free website on Tripod.com

com.yellowpig.rod.app.watchdog
Class ProcessLauncher

java.lang.Object
  |
  +--com.yellowpig.rod.app.watchdog.ProcessLauncher

public class ProcessLauncher
extends java.lang.Object

A utility for launching and monitoring processes. A launched process can be automatically restarted when it goes down.

See the documentation for the main method for information on how to use the ProcessLauncher.

You can also view the source for this class.

This program and its documentation are copyright © 1999 Rodney Waldhoff. You must agree to the licensing terms in order to read, use, distribute or deploy this software or its documentation. (Don't worry, it's Open Source.)

Version:
1.0 [1999.03.23]
Author:
Rodney Waldhoff <rwald@hotmail.com>
See Also:
RunnableLauncher

Field Summary
private static java.lang.String COMMENT_STR
          The string that starts a comment line.
private static int DELIM_CHAR
          The delimiter that separates the "restart flag" from the command to execute.
 
Constructor Summary
ProcessLauncher()
           
 
Method Summary
static void main(java.lang.String[] args)
          The application's main method.
protected static void printBanner()
          Outputs the application's "banner" to System.out.
protected static void printUsage()
          Outputs the application's "help" to System.out.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

DELIM_CHAR

private static final int DELIM_CHAR
The delimiter that separates the "restart flag" from the command to execute.

See Also:
main(java.lang.String[])

COMMENT_STR

private static final java.lang.String COMMENT_STR
The string that starts a comment line.

Lines beginning with this string will be ignored.

See Also:
main(java.lang.String[])
Constructor Detail

ProcessLauncher

public ProcessLauncher()
Method Detail

main

public static void main(java.lang.String[] args)
The application's main method. Launches and optionally monitors/restarts a set of processes, as specified by a parameter file.

Usage:

From the command line:
java com.yellowpig.rod.app.watchdog.ProcessLauncher <paramfile>
Within your Java code:
com.yellowpig.rod.app.watchdog.ProcessLauncher.main((String[]){"paramfile"})
where <paramfile> is the platform-specific path to a parameter file.

Parameter files are composed of lines with the following format:

<restartflag>DELIM_CHAR<command>
where
<restartflag>
indicates whether or not to restart the process when it closes. (The case-insenstive string TRUE indicates that the process should be restarted, all other strings cause the process to be forgetten about once started.)
<command>
is a platform-dependent command that launches the process to be monitored. (see java.lang.Runtime.exec(String))
Blank lines and lines beginning with COMMENT_STR are ignored.

Parameters:
args - The command-line arguments.

printBanner

protected static void printBanner()
Outputs the application's "banner" to System.out.

printUsage

protected static void printUsage()
Outputs the application's "help" to System.out.