Running the Batch Console (bconsole)

The Batch Console program (bconsole) has a command line of the form:

bconsole [options] filename [argument list]

where filename is the name of a text file that contains commands for the Batch Console to interpret.

Note: All scripts start with the current directory set to the service’s working directory. Additionally, the service sets up the environment variable INSTALLDIR that points to the install directory where the Batch Console program resides. You must use this environment variable as the path when invoking the Batch Console (on Windows, %INSTALLDIR%\bconsole; on UNIX, $INSTALLDIR/bconsole). You cannot rely on the install directory being in the PATH. For more information about Batch Console, see Introducing the Batch Console.

You can include additional arguments to pass parameters to the program. This allows you to use generic source files that work with externally-supplied values for the parameters. The command-line parameters in [argument list] are referenced in the script file using the Windows command file conventions (%1 is parameter 1, %2 is parameter 2, and so on). For example, if you invoke bconsole using the statement

bconsole /P secret resume.bcs 1234

the program substitutes the text "1234" for any occurrence of "%1" in the script file "resume.bcs" the same as Windows command files.

The following command file performs the aforementioned task for a data source named MISDB. MISDB uses the service that runs on a machine named "galactica" using port 8001. The language allows lots of buzz words which are included to make the scripts read like plain English but which are ignored by the parser. (Words in black are buzz words.)

connect to galactica port 8001

enable data source MISDB

process MISDB

If a command fails, the program returns a non-zero exit status indicating a failure. On successful execution of the script, the program returns an exit status of 0. Each executed script is logged; if something fails, you can look at the log file to determine what went wrong.

The user ID of the user that launches the bconsole run is used to sign on to the service. When the Batch Console program starts from a script that the service launches, the script is passed a handle for use as a temporary password. This eliminates any security problems that having user IDs or passwords in the script files might cause. If the service cannot authenticate the user ID password, it verifies that the user is the same one that is running the service. (This is typically the built-in SYSTEM account). If it is, the service verifies that the handle matches the one assigned to the thread that launched the script. (The handle contains the thread number.)