Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script using nsradmin to create clients

Status
Not open for further replies.

hermxl1

IS-IT--Management
Feb 12, 2004
24
US
Hi,

I need to create about 400 clients on a Solaris Networker server and I've been playing with getting a script to do it, but with my limited scripting skills I've not been successful with getting a $CLIENTNAME variable read into a nsradmin -i commands script.

Does anyone have a simple snippet of a script that successfully passes a variable in the nsradmin script? Any help is appreciated.

Thanks,

Herm

 
Ok, on Unix, this will give you a one liner to create a client. Notice, you would need to do something similar to make other options parameters.

have a script that does:
sed 's/ZZZZZZZZZZ/'$1'/' clientin.param >client1.param
nsradmin -i client1.param

where:

(sunnwserver is the name of your Networker server)

Where clientin.param contains the following commands:

create type:NSR client;
name:ZZZZZZZZZZ;
server:sunnwserver;
schedule:Full;
browse policy:Month;
retention policy:Year;
group:Default;
save set:All;
aliases:ZZZZZZZZZZ;
storage nodes:nsrserverhost;
 
This is an example of the syntax I use for this type of script:

Code:
CLIENTNAME=whatever

echo "
create type: NSR client;
       name: $CLIENTNAME;
       group: ThisGroup
" | nsradmin -i -

Obviously you'd want to fill a few more fields in but you get the general idea.
 
Ok,

The script I have works, but I'm trying to create the clients as members of 2 groups and I get the following error:

create failed: 'DAILY_FRI_UNIX_OFFSUN, OFFSITE_SUN1' invalid choice for 'group', try Default

The file that the script uses for input has the group field delimited as such:

""DAILY_FRI_UNIX_OFFSUN", "OFFSITE_SUN1""

Any ideas on how the group field must have multiple entries separated?

Thanks,

Herm

 
With my intention to teach, may i just ask you to create such a resource and to have a look at the resource file later? - the GUI does not do anything else in the background.

 
For 2 groups, you need 2 clients defined is what she is trying to say.
 
I don't think anyone is saying you need two clients. It's not true anyway, one client resource can be associated to two groups. This snippet of code will do it:

Code:
echo "
create type: NSR client;
       name: $CLIENTNAME;
       group: ThisGroup, ThatGroup
" | nsradmin -i -
 
Thanks Davina,

But that was one of the first things I tried and it didn't work either. I got a different error message saying that it was an unterminated field.

I gave up though, and just ran the script with only 1 group per client and I'll add the additional group from the GUI later.

Thanks for the help everyone...

Herman

 
Looks like you're getting bogged down in syntax. Notice that my group line is the last one, hence no semi-colon. If I had added further lines every one except the last would end in a semi-colon. Was this your problem?
 
Nope,

I tried moving the group from the middle to the end, with and without the ";" Too much effort in this for a simple function.

Thanks for the help...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top