Unsolved

This post is more than 5 years old

2 Intern

 • 

1.1K Posts

1501

June 19th, 2009 07:00

Rename client script

One thing I have been tasked with is to have a consistent naming of clients across all backup zones, ie those clients that have been entered as a client by the short name will be deleted and readded as their FQDN as long as they check out successfully with DNS now (with hosts files being largely phased out). Since there are several hundred clients I will do this by script so here is what I am planning to do:

nsradmin query to extract the following fields and write to a temp file:

type;name;client id;comment;scheduled backup;schedule;browse policy;retention policy;directive;group;save set;remote access;remote user;password;backu
p command;Save operations;aliases;parallelism;application information;ndmp;storage nodes;clone storage nodes;recover storage nodes

Split temp file up into individual temp files for each client entry.

For each file extract name and determine if short or long name - if long name do nothing further, if short name:

extract FQDN from aliases field
run DNS lookups against short and FQDN; run reverse lookup

If problem update comment field to indicate DNS issues and do nothing further with this client

Delete client entry using nsradmin and client temp file
Amend client temp file changing short name to FQDN; amend comment field
Use client temp file to create new entry; apply twice due to using same client ID

Can anyone see anything missing here; particularly with checking other client types for that client, pools etc?

2 Intern

 • 

1.1K Posts

June 19th, 2009 08:00

What would happen with the media database entries, would they be removed when the client is removed or would it be at next nsrim run - this would necessitate scanning a large number of tapes in?

5 Posts

June 20th, 2009 21:00

This is one trouble thing,you need to change whole index information.
It's not suggested.

2 Intern

 • 

1.1K Posts

June 22nd, 2009 01:00

That should not be a problem, I will retain the client ID and set the index path field to be /nsr/index/shortname. The question is does the media database remove its entries when the client is deleted (like doing an nsrmm -d) or do they remain and get cleared down at the next run of nsrim? The first case would necessitate scanning in lots of media again - probably impractical, the second should not. I will run some tests on this and see what happens...

6 Operator

 • 

14.4K Posts

 • 

56.2K Points

June 22nd, 2009 06:00

When you delete the client mdb won't be touch. As soon as it is renamed due to the same clientid this will be reflected to mdb. After that you just need to stop NW, rename old clientname dir in index to new one and start it up.

25 Posts

June 22nd, 2009 08:00

my suggestion would be to manually conduct your steps on one client and see if the results you achieve is what you want. next, develop a script and run it on one another client before running it over across all others.

2 Intern

 • 

1.1K Posts

June 25th, 2009 02:00

Thanks Hrvoje, I hoped that would be the case!

2 Intern

 • 

1.1K Posts

July 1st, 2009 07:00

Hrvoje

You were correct. There is just one thing I think it will be useful to add here, that the index needs renaming to what the new client name will be prior to it being recreated otherwise it creates a new client index.
If you can reply to this I can give you your green star as I have already marked your response as helpful!

6 Operator

 • 

14.4K Posts

 • 

56.2K Points

July 11th, 2009 02:00

Yes, but even if you get new client index, by stopping NW and moving old index folder to new one (mv old_name new_name) will do the trick.

2 Intern

 • 

186 Posts

July 13th, 2009 01:00

Hi david, (Hoping for that green star)

if you export the client id and the short name and create the new client with the old client id and the short name in the alias colum, i think that might waork and you would not need to touch the Media DB. If i'm wrong please post so i know.

2 Intern

 • 

1.1K Posts

July 13th, 2009 03:00

Already solved Scott - I captured the nsradmin output, split it into sections for each client, extracted the name, verified rpcinfo -p (ping fails for some clients as they are behind a firewall), verified name resolution was consistent and extracted FQDN, if OK delete client, rename index to /nsr/index/fqdn, add client (twice) using nsradmin and including client ID, add any other client instances (once). All worked okay on an old server, we are going run the script on out production boxes sometime this month.

0 events found

No Events found!

Top