Operating System - HP-UX
1846988 Members
3419 Online
110257 Solutions
New Discussion

Using set_parms in script

 
SOLVED
Go to solution
Mauro_8
Frequent Advisor

Using set_parms in script

Hi,

I??m using "set_parms ip_address" to change the IP address of my HP, but I want that a script do it, so I try do something like this as root,create a script called ip.csh with this commands:
set_parms << EOF
10.4.6.45
y
n
EOF

That is the order of the set_parms interaction, first the new IP, then y to confirm and then n to no reboot, then I must reboot it in my script. I did the same to "set_parms hostname" and it did not work.

Any ideas how doing it in a script and in the last line of the script I put the reboot.

Cheers,
Mauro
12 REPLIES 12
Mauro_8
Frequent Advisor

Re: Using set_parms in script

Hi,

The script in the original message was posted wrong, I tried the script :

set_parms ip_address << EOF
10.4.6.45
y
n
EOF

Sorry.

Any ideas ?

Cheers,
Mauro

Martin Johnson
Honored Contributor
Solution

Re: Using set_parms in script

Why would you want to do this in a script? It is usually a one time deal and not worth the trouble to write and debug a script.

Marty
harry d brown jr
Honored Contributor

Re: Using set_parms in script

Is there a reason why you don't assign points too often?

This member has assigned points to 3 of 73 responses to his/her questions.

To find your previous posts click here:
http://forums.itrc.hp.com/cm/TopSolutions/1,,CA745685!1!questions,00.html

The set_parms program is a script, maybe you can accomplish the same thing by copying the code?

live free or die
harry
Live Free or Die
Mauro_8
Frequent Advisor

Re: Using set_parms in script

Hi,

I have two HP machines one is backup of the other, so if one fails I need to change the IP address and the hostname. Doing it the HP machines become the same. When I do it I take the failed out of the network, so there is no IP conflict.
Using a script is the fast way to do this change. Everytime these machines have two know IP address, only change the IP to put the computer "on-line", this way I do not need do reconfigure the clients anf their hosts.

Understand ?

Any ideas ?

P.S: I'm goint to assign points. Sorry.

Cheers,
Mauro
Martin Johnson
Honored Contributor

Re: Using set_parms in script

Have you looked into MC ServiceGuard? It will automatically failover if one system goes down. You can put you applications in one or more packages and the packages will move from one system to the other, including the target IP address. Each node of the ServiceGuard cluster will have its own IP address, to access the node. While there will a floating address that will go with the applications.

HTH
Marty
Misa
Frequent Advisor

Re: Using set_parms in script

Depending on what you're doing, you might want to look at /etc/rc.config.d/netconf. This is where the things are actually stored, and it's just a file.

--Misa
Mauro_8
Frequent Advisor

Re: Using set_parms in script

Hi,

These two IP address are static, so I will only have these two IP addresses one in each computer. Do you think it a good idea to keep two /etc/rc.config.d/netconf files one as netconf_1 and other as netconf_2, each one using one IP address and hostname and when I want to change the hostname and the IP I just copy the netconf_1 or _2 to netconf ? Then send the command net stop and net start in this order.
It should be done to /etc/hosts too.
It would be easy to implement using a script.

Is this a good idea ?

Regards,
Mauro
Bill Hassell
Honored Contributor

Re: Using set_parms in script

Oops, not a good idea to have netconf_1 and netconf_2. EVERY file in /etc/rc.config.d is sourced during the bootup steps (well, the rc section) and thus, every setting from every file will take effect. Better keep the information in a script which directly modifes the one netconf file--and make sure there are no 'extra' files in /etc/rc.config.d


Bill Hassell, sysadmin
Mauro_8
Frequent Advisor

Re: Using set_parms in script

Hi Bill,

It??s true but I can keep these file in /tmp, for example. If I choose to make a script, how can I do a script to directly modife the netconf ? It is my first idea.

Regards,
Mauro
Misa
Frequent Advisor

Re: Using set_parms in script

If you put your netconf1 and netconf2 in /tmp, they may be deleted the next time your system is rebooted. Depends on your system configuration (look at /etc/rc.config.d/*clean*). Probably not what you want.

The old UNIX standby is /usr/local; you could make a /usr/local/etc/rc.config.d directory, for example. There are problems with /usr/local, though, including: you take up space in /usr, which tends mostly to be purely what came with the OS (I try to keep it that way for recovery), /usr/local is by default world-writeable (not good), and everyone and their brother would probably try to hack /usr/local. I think /opt/local is a good idea.

Editing netconf: if you're not an experienced programmer, I would handle this very carefully. You might take more time getting it going (after you got the wrong stuff in there and rebooted) than its worth. You might rather do the "cp netconf1 ..." approach. BUT if you want to edit it in place, I tend to like Perl. Others will claim awk or sed is better, or shells. O'Reilly publishing makes excellent books on this type of programming.

What you're doing, basically, is starting to re-invent MC/ServiceGuard. If your management is asking you to do this, suggest ServiceGuard to them. It will require training and/or professional services to implement, however. But it's better than re-inventing the wheel. :)

--Misa
Mauro_8
Frequent Advisor

Re: Using set_parms in script

Hi,

It??s a good product but I feel like killing an ant with a atomic bomb :-) I don??t need the system on-line everytime, if it has a downtime of 10 minutes it??s great because these machines work fine, I just needed to change the host one time in the last two years. I only want a script because I could teach all the employees that work with these machines to run this script, if not and the on-line machine fail at 11 PM I think I??m going to lost my soccer game in TV and go to the company to make this procedure.

Thanks once more.

Regards,
Mauro