Take a look at smit.script and it might be clearer. I had to set up a large NIM server and it has a lot of client systems. Here is what I did:
1. First set up your network resources, especially if your clients are on different subnets. A sample of the script I used is below.
2. Then set up your machine resources. A sample of that script is after the network resources script.
network resource scripts:
add_network()
{
IEEE_ENT=
while getopts n:t:a:s:c

:i:g: option
do
case $option in
n) NAME=$OPTARG;;
t) TYPE=$OPTARG;;
a) NETADDR=$OPTARG;;
s) SNM=$OPTARG;;
g) GATEWAY=$OPTARG;;
o) OTHER_NET=$OPTARG;;
i) IEEE_ENT=$OPTARG;;
c) COMMENTS="$OPTARG";;
esac
done
nim -o define -t ${TYPE} -a net_addr=${NETADDR} -a snm=${SNM}
${OTHER_NET:+-a other_net_type1=$OTHER_NET} ${GATEWAY:+-a routing1=
"default ${GATEWAY}"} ${IEEE_ENT:+ -a ieee_ent=yes} ${COMME
NTS:+-a comments="${COMMENTS}"} ${NAME}
rc=$?
return $rc
}
[NOTE: this sets up the function you are going to use.]
add_network -n '10_2_4_subnet' -t 'ent' -a '10.2.4.0' -s '255.255.255.0' -g '10.2.4.1' -c '10.2.4 subnet'
NOTE: -n is the name of the resource. -t is the type of resource. I can't remember what -a is for, but it is always the .0 address of the subnet. -s is the netmask. -g is the gateway. -c is the comments field.
For each network, add an "add_network" line to the script.
machine setup secript:
add_machine()
{
HADDR=0
while getopts N:t

:T:n:h:a:l:C:c:E:U:k:S:d:K: FLAG
do
case $FLAG in
N) NAME=$OPTARG;;
t) TYPE=$OPTARG;;
P) PLATFORM=$OPTARG;;
T) CABLE=$OPTARG;;
n) NETNAME=$OPTARG;;
h) HOSTNAME=$OPTARG;;
a) HADDR=$OPTARG;;
l) ADAPTER=$OPTARG;;
C) CPUID=$OPTARG;;
c) COMMENTS=$OPTARG;;
E) IPLROM_EMU=$OPTARG;;
U) GROUP=$OPTARG;;
k) NETBOOT_KERNEL=$OPTARG;;
S) SPEED=$OPTARG;;
d) DUPLEX=$OPTARG;;
K) NIMSERVICE=$OPTARG;;
esac
done
[ -n "$ADAPTER" ] && PIF="$NETNAME $HOSTNAME $HADDR $ADAPTER"
|| PIF="$NETNAME $HOSTNAME $HADDR"
if [[ -n "$SPEED" || -n "$DUPLEX" ]]
then
NET_SETTINGS="$SPEED $DUPLEX"
fi
nim -o define -t $TYPE -a platform=$PLATFORM -a if1="$PIF"
${CABLE:+-a cable_type1=$CABLE} ${NET_SETTINGS:+-a net_settings1="$NET_SETTINGS
"} ${IPLROM_EMU:+-a iplrom_emu=$IPLROM_EMU} ${GROUP:+-a group=$GRO
UP} ${NETBOOT_KERNEL:+-a netboot_kernel=$NETBOOT_KERNEL}
${NIMSERVICE:+-a connect=$NIMSERVICE} ${CPUID:+-a cpuid=$CPUID}
${COMMENTS:+-a comments="$COMMENTS"} $NAME
rc=$?
return $rc
}
add_machine -N 'systemhostname'-t'standalone' -P 'chrp' -k 'mp' -K 'shell' -T'N/A' -S
'100' -d 'full' -n'10_3_4_subnet' -h'systemhostname' -a'0' -c'commentsline'
{NOTE: this sets up the function you will use in your script]
-N is the name of the resource, I believe. -t says what kind of NIM machine it is. Can also be diskless or dataless. -P is the platform. -k says whether is it multiprocessor or uniprocesser (up). -T I'm not sure. -S is the speed of the network card. Make sure this matches what is on the system. -d says whether it is full duplex, half duplex or autonegotiate. -n is the network resource you set before. -h I'm not sure. -a I'm not sure. -c is the comments line.
Sorry about the "not sures." I developed the script quickly because someone had totally trashed our old NIM server and I had to quickly rebuild a new one. I did it by taking the lines from smit.script after I defined one network and one machine and adding at the botton all the add_machine or add_network lines I needed. One thing if you model your script from smit.script: One of the scripts in smit.script didn't have the
rc=$?
return $rc
lines, so the script would just stop after the first system or network was defined.
Hope this helps.