2.3. Sending Commands

In addition to the configuration file, commands can be sent directly to the Cascade TextLogger at any time while it is running, by using the Cogent lsend utility or your own code. Commands that are commonly issued at run-time include enable and disable, which control the writing activity of each log; the output command that lets you insert a descriptive string into a file; and exit.

The syntax for run-time commands is the same as that used in the configuration file. It consists of the name of the command, followed by a space-separated list of arguments, all enclosed in parentheses, like this:

(command arg1 arg2 arg3 ...)

If you plan to send commands from a Gamma program, say with the send function, the syntax is slightly different. The command name is outside the parentheses, and the arguments are separated by commas, like this:

command (arg1, arg2, arg3, ...)

Should you need to use this Gamma syntax elsewhere, you can use the lsend command with the -g option (or gsend, which is essentially the same thing).

To use lsend for sending commands to the Cascade TextLogger, follow these steps:

  1. Go to a shell and ensure that the Cascade DataHub is running by issuing the nsnames command:
    [sh]$ nsnames
    Task            Queue           Domain          Node TaskID
    /dh/default     default         default         0    8521  
    logger          logger          default         0    19544 
    This gives you a list of named tasks currently registered with nserve. The Cascade TextLogger should be listed by the global name you registered for it when you originally started it up, using the textlog command. (In the example above the name is logger.)
  2. Enter the following:
    [sh]$  lsend nserve-name
    nserve-name>
    where nserve-name is the registered name of the Cascade TextLogger you wish to send commands to. If the command is successful, the prompt will change to that name.
  3. Enter a command, using the Lisp syntax given above. For example:
    [sh]$  lsend logger
    logger> (disable log2 log5)
    t
    logger>
    When the command executes successfully, it returns t; otherwise it returns nil. You can send as many commands as you like at once, by typing them one after another, like this:
    logger> (disable log4)(enable lognone)(output log6 "Continuing...")
    t
    logger>nil
    logger>t
    logger>
    The Cascade TextLogger returns t or nil for each command independently (it also returns a prompt for each, which you can ignore), and continues processing until all the commands have been attempted.