5.5 Using Server Batch Files

This section explains how to use .ncf batch files to load modules, execute System Console commands, and configure subsystems. For procedures, see the following:

A server batch file is an executable file containing server console commands. You execute the file by entering its name at the System Console prompt. NetWare then executes all the commands in the file in order.

By default the NetWare installation process creates two batch files that are always executed whenever the server is booted:

In addition, you can create a batch file called shutdown.ncf in sys:system to execute commands whenever you shut down the server. The DOWN command executes shutdown.ncf automatically whenever the server is shut down, so you should never include the DOWN command in the shutdown.ncf file.

You can create any other batch files you need. Simply create a text file with a .ncf extension. Place NetWare console commands into the batch file in the order that you want them executed.

5.5.1 Using EDIT to Create and Edit Text and Batch Files

NOTE:Each time you save the file, you can increase the file size by up to 4 KB.

  1. At the System Console prompt, enter

    [LOAD] EDIT [path]

    If you specify a path, include both the directory and filename. The file must be located on a mounted volume or on a local drive of the server.

    If you do not specify a path, the system displays a prompt at which you can either enter the filename or display a browse window.

    • To enter the filename, type either the complete file path (volume, directory, and filename) or just the filename, and press Enter.

      If you enter only the filename, the system assumes a default location of sys:system.

      If the file does not exist, EDIT displays a prompt that asks whether the file should be created. Choose Yes to create the new file or No to redisplay the filename prompt. If you choose Yes, EDIT displays a blank screen so you can enter text into the file.

    • To display the browse window, press Insert.

      To see the contents of a volume or directory, select the volume or directory name and press Enter. Use the arrow keys to scroll up and down the list of files and directories. To display a file, select the filename and press Enter.

  2. Create or edit the file as needed.

    To get a description of the keystrokes to use while using EDIT, press F1.

  3. When finished, press Esc. Select Yes to save the file or No to exit the file without saving changes.

    The system redisplays the pathname prompt.

  4. To edit or create another file, enter the file pathname. To redisplay the System Console prompt, press Esc.

For more information, see EDIT in the NW 6.5 SP8: Utilities Reference.

5.5.2 Using NWCONFIG to Create and Edit Startup Batch Files

The following procedure explains how to use NWCONFIG to create or edit the startup.ncf and autoexec.ncf files.

  1. At the System Console prompt, enter

    [LOAD] NWCONFIG

  2. Select NCF Files Options.

    The system displays a menu containing options to create or edit both the startup.ncf and autoexec.ncf files and to upgrade a NetWare 3.1x autoexec.ncf file.

  3. Select the desired option and press Enter.

    If you select the option to upgrade the NetWare 3.1x file, follow the screen prompts. NWCONFIG compares the file with the current NetWare configuration and makes changes to the file as necessary. You can edit the file before saving it.

    If you select an option to edit one of the files, the selected file appears in a window.

    If you select an option to create one of the files, the system displays the existing file, if there is one, in one window and a new file with default entries in another window, so you can compare the two.

    The default entries include only essential contents of the file and reflect the current system setup. For example, the default entries for autoexec.ncf might include time zone information and LOAD and BIND commands for currently installed LAN drivers, but would not include custom configuration settings you have in the original file.

    The cursor is active in the new file. Press Tab to toggle between the two files.

  4. Edit the new or existing file as necessary.

    Editing and navigation keystrokes are listed at the bottom of the screen. For additional help, press F1.

  5. When finished, save the file by pressing F10 and selecting Yes when prompted. To exit without saving, press Alt+F10. Changes to the file take effect after you reboot the server.

    IMPORTANT:Each time you edit the autoexec.ncf file or the startup.ncf file, NetWare saves the previous version as autoncf.old or startncf.old.

For more information, see NWCONFIG in the NW 6.5 SP8: Utilities Reference.

5.5.3 Making a Command Optional in a Server Batch (.Ncf) File

By default, a .ncf file executes all the commands within it. However, to make a command optional, you can place a question mark (?) in front of it.

The question mark causes the .ncf file to pause at the command and prompt you to execute it. You can respond either Yes or No. You can also specify a default response.

For example, the following line in the autoexec.ncf file causes the file to pause and ask whether to execute the LOAD MONITOR command:

? load monitor

When the autoexec.ncf file is executed, it displays the following prompt:

load monitor? y

The default response is Yes. If you do not respond to the prompt, the default response is executed after 10 seconds.

Both the default response and the time period are configurable.

Setting the Default Response

There are two ways to configure the default response to the command prompt:

  • Specify the default on the command line in the .ncf file. Place the default response (a Y or N) immediately following the question mark. For example,

    ?n load monitor

    In this example, the default response is N. If the user does not respond to the prompt, Monitor is not loaded.

  • Set the Command Line Prompt Default Choice parameter (Miscellaneous category) to either On or Off. On means the default response is Y for Yes; Off means the default response is N for No.

    The parameter setting is overridden by a default specified on the command line.

Setting the Time Period

To configure the time period before the default response is executed, set the Command Line Prompt Time Out (Miscellaneous category) parameter to a time in seconds. The default value is 10 seconds.

5.5.4 Checking the Execution of .ncf Files

If you want to check the functionality of each line in a .ncf file, you can use run the KF8 ON command at the System Console prompt. This lets you lets you pause the execution after each command of a .ncf file.

When you are finished, execute the KF8 OFF command to turn off this functionality.

5.5.5 Changing the Server Name and Internal Address in Autoexec.ncf

The server’s name is stored in the autoexec.ncf file. You can change the server name by editing the file. However, changing the server name in the autoexec.ncf file does not affect Novell eDirectory Server objects. You must use ConsoleOne® to rename eDirectory Server objects.

IMPORTANT:Be sure to use ConsoleOne to update any references to the former server name in the eDirectory tree and in the timesync.cfg file.

The server’s internal network number is also stored in the autoexec.ncf file. Even if you use Novell’s native IP protocol, the internal network number is used as a server ID and will still be stored in the autoexec.ncf file. Do not delete the number.

To change either the server name or the internal network number in the autoexec.ncf file, use NWCONFIG or EDIT at the System Console prompt, then reboot the server.

To use NWCONFIG to change the settings, see Using NWCONFIG to Create and Edit Startup Batch Files. To use EDIT, see Using EDIT to Create and Edit Text and Batch Files.