Sun N1 System Manager 1.3 Discovery and Administration Guide

ProcedureTo Run a Script of N1 System Manager Commands

The following procedure describes how to run a custom script of N1 System Manager commands that are saved in a file. Return codes are returned for each command. Also, you can specify a comment character (#) at the beginning of the line to indicate that the rest of the line should be ignored.

Steps
  1. Log in to the N1 System Manager.

    See To Access the N1 System Manager Command Line for details.

    If the n1sh shell is your default login shell on the management server, you must change this configuration. Otherwise, you won't be able to run the n1sh command and use the script option.

  2. Run a custom script that contains the N1 System Manager commands.


    # /opt/sun/n1gc/bin/n1sh -f filename
    

    where filename is a fully qualified path to the custom script file.


Example 1–1 n1sh Custom Script File

The following example shows an n1sh script file, which can be run with the n1sh -f command.

# n1sh custom script

show group all 

create group RACK1   
create group RACK2   
create group RACK3   
create group RACK4   
create group RACK5   


add group RACK1 server SERVER1  
add group RACK1 server SERVER2  

add group RACK2 server SERVER3  
add group RACK2 server SERVER4  


add group RACK3 server SERVER5  
add group RACK3 server SERVER6  

add group RACK4 server SERVER7  
add group RACK4 server SERVER8  

add group RACK4 server SERVER9  
add group RACK4 server SERVER10  

add group RACK5 server SERVER11  
add group RACK5 server SERVER12  

show group all