Command File Definition Controls


The Command with File response automatically executes a file (series) of commands on any Vantage-managed resource or Group of resources, regardless of platform.
The figure below is the Command with File Definition dialog.

Command File Definition Dialog
Refer to Using Vantage Dialogs to learn about Vantage dialogs. Each control on the dialog is explained in the text that follows.
Command File Definition Controls
Send Command File:
This control is used to specify the name of the file that contains or will contain the commands to be executed. Click the control and type the file name.
To Resource / Group:
This control is used to select the name of the resource or group on which the commands are to be executed. If the command should only be sent back to the resource on which the event was detected, then select '[Originating Resource]'. Click to select the resource or group and click Add/Modify.
A Text Editor will be started and will either display the file to allow changes or create it if it does not already exist. Type one command per line unless the resource's operating system supports multiple commands on the line.
The following figure shows the Text Editor window with a sample command file.

Text Editor with sample Command File
As with the Command event response, variables can be included in the Command with File response. Tokens from the event's context string are passed to the command file in variables designated as $1, $2, etc.
Refer to Keywords in Command Files for information on using Keywords.
Edit the file, save it then exit the editor. Click OK when all controls are as desired. Click the Add button on the Event Definition dialog to add the event.
You must Distribute Events when finished adding or modifying an event for the new event to be detected.
See also Operating Vantage and Keywords in Command Files
Special keyword meta-commands can be included in the Command with File event response to control the execution of command files and to perform functions normally done through dialogs.
Keyword meta-commands are commands that have special meaning when used in command files. The following text describes keywords and their syntax.
$TERMINATORON (the default) sends the EOL Character specified for the resource at the end of each line. $TERMINATOROFF will not send the line terminator until the $TERMINATORON keyword is issued. $PAUSE n pauses "n" number of seconds before executing the next command.
The keyword $WAITFOR can be used to signal Vantage to wait for a specific response (string) before continuing execution of the command file. Timers can be set which will wait a specific number of seconds (timeout) before either repeating the previous command, continuing the command file or discarding the remainder of the command file. The following explains the syntax of the $WAITFOR keyword.
$WAITFOR string
Stops execution of the command file until string is returned by the resource. If the WAITFOR string includes white space the string must be enclosed in double quotes, (i.e., $WAITFOR "Shut Down Compete" ). WARNING: In this form string MUST be returned before processing of the command file will continue.
$WAITFOR string timeout
Stops execution of the command file until string is returned or until timeout seconds elapse. When string is returned or when timeout seconds elapse, execution of the command file continues with the statement immediately following the $WAITFOR keyword.
$WAITFOR string timeout FLUSH
Stops execution of the command file until string is returned. When string is returned the command file continues with the statement immediately following the $WAITFOR keyword. If timeout seconds elapse before string is returned the remainder of the command file is discarded.
$WAITFOR string timeout REPEAT
Stops execution of the command file until string is returned. When string is returned the command file continues with the statement immediately following the $WAITFOR keyword. If timeout seconds elapse before string is returned the command immediately preceding the $WAITFOR keyword is repeated until string is returned.
WARNING: In this form string MUST be returned before processing can continue.
$WAITFOR string timeout REPEAT count
Stops execution of the command file until string is returned. When string is returned the command file continues with the statement immediately following the $WAITFOR keyword. If timeout seconds elapse before string is returned the command immediately preceding the $WAITFOR keyword is repeated until either string is returned or until count is reached at which time the command file continues with the statement immediately following the $WAITFOR keyword.
$WAITFOR string timeout REPEAT count FLUSH
Stops execution of the command file until string is returned. When string is returned the command file continues with the statement immediately following the $WAITFOR keyword. If timeout seconds elapse before string is returned the command immediately preceding the $WAITFOR keyword is repeated until either string is returned or until count is reached. If count is reached before string is returned the remainder of the command file is discarded.
Dynamic Control of Logging
Console logging can be dynamically controlled through the Command with File event response. The keywords $CONSLOGON and $CONSLOGOFF can be used to interactively start and stop Console logging respectively. The following explains the syntax of the $CONSLOGON and $CONSLOGOFF keywords.
$CONSLOGON
Starts Console logging on the resource if logging was not already enabled or restarts logging if it had been stopped. If logging was not previously enabled the conslog.on file will be created with the default 5 logs of 100 Kbytes each.
$CONSLOGON count
Starts Console logging on the resource if logging was not already enabled and/or changes the number of logs maintained to the value in count if logging was already running. If logging was not previously enabled the conslog.on file will be created with the value of count as the number of logs maintained.
$CONSLOGOFF
Stops logging on the resource and closes the current log file. Logging will remain off until either a $CONSLOGON is issued or until monitoring on the resource is stopped and restarted. Log files will remain in the resource's directory.
$CONSLOGOFF NORESTART
Stops logging on the resource, closes the current log file and removes the conslog.on file for the resource. Logging will not be started when monitoring on the resource is stopped and restarted. Log files previously created will remain in the resource's directory.
$CONSLOGOFF FLUSH
Stops logging on the resource, closes the current log file and removes the conslog.on file. WARNING: The FLUSH command will remove all log########## files from the resource's directory.
Vantage Monitor keywords can be included in command files that will communicate directly with a resource's monitor process. These keywords correspond with the controls on the Monitor Status dialog. Including these commands in a Command file will have the same effect as clicking the control on the dialog. The following commands are available:
$DETECTIONON, $DETECTIONOFF; $RESPONSEON, $RESPONSEOFF; $COMMANDON, $COMMANDOFF; $NEDON, $NEDOFF and $QUIT. ($QUIT has the same effect as clicking Stop Console.)
See The Monitor section for an explanation of the effect these Monitor commands have on the function of the monitor.
Catwalk 3.0 controls
Keywords can be used to control the state of Catwalk 3.0 hardware. The Catwalk meta-commands are listed and explained in the text that follows.
$CWNORMAL
Sets the catwalk switch to Normal mode. The resource's console terminal is blocked. The Vantage keyboard accepts input.
$CWMAINT
Sets the catwalk switch to Maintenance mode. The Vantage keyboard is blocked. The resource's console terminal accepts input.
$CWSHARED
Sets the catwalk switch to Shared mode. Neither side of the connection is blocked. Both keyboards accept input.
$CWBLOCKED
Sets the catwalk switch to Blocked mode. Both keyboards are blocked. Neither keyboard accepts input.
$CWADVANCE
Advances the state of the catwalk switch to the next state. (Shared-->Normal-->Maintenance-->Blocked-->etc.)
$CWNEWSTAT
Writes the current catwalk state to systems/[resource_name]/catwalk.status to create a new current state.
$CWINIT
Sets the catwalk switch to the value in systems/[resource_name]/catwalk.init as defined by the Resource Definition dialog.
$CWPREV
Set the catwalk switch to the value in systems/[resource_name]/ catwalk.status
See also Operating Vantage