Managing NerveCenter - Controlling NerveCenter from the Command Line - NerveCenter Command Line Interface - Running a script that contains one or more commands -
Previous: Entering Multiple Commands in an Interactive Session     Next: Index

Running a script that contains one or more commands

 
  To run a script that contains one or more commands, follow these steps:

  1. Create a text file that contains the commands in the order you would enter them if you were in an interactive session.

    The syntax for the commands is specified in Command line interface reference.

  2. Open a DOS Command Prompt window or a UNIX shell.
  3. Do one of the following:

    To connect to a NerveCenter server and have the server execute the commands in your file, enter a command of the following form:


       nccmd -s ServerName -u UserName -p Password -n Port -f Filename

    ServerName is the name of the NerveCenter server you want to contact, UserName and Password are a valid user name and password for that NerveCenter server, Port is the command-line-interface port for the server (32506 by default), and Filename is the name of the file containing the commands you want to run.

    To prevent having to connect to the server explicitly each time you want to run your script, you can edit your script so that its first line is a connection command. This command must have the form:


       connect -s ServerName -u UserName -p Password -n Port

    Once you've performed this step, you can type nccmd -f Filename from the DOS or a shell prompt to connect to the server and execute the commands in your script.

    If any command returns an error, nccmd quits, displays the error, and returns you to the Command Prompt or UNIX prompt.

In the following example, a user named Juan writes a script that connects to a server, turns on an alarm named Monitor, and disconnects from the server. For this example, the server is named sales, Juan's user ID is juanr, and his password is CaFFieNe. The script is named SetAlarm and it looks like this:


   connect -s sales -u juanr -p CaFFieNe -n 32506
set alarm -e on -w -a Monitor
disconnect -s sales

Juan runs the script by entering the following command at the command prompt:


   >nccmd -f SetAlarm


Previous: Entering Multiple Commands in an Interactive Session Next: Index
Please send comments or corrections to Information Development
This file was last updated on 10 October © 2002