Operating System - HP-UX
1837314 Members
2968 Online
110116 Solutions
New Discussion

Re: Installing patches at re boot

 
Paul Thomson_2
Super Advisor

Installing patches at re boot

I have a patch which really needs to go to many servers, around the world. The main problem I have is that as these servers are worldwide and as a result getting downtime for this particular patch is dificult. However on weekends, we have our own re boot script. What I plan todo is to change this to install the patch and then re boot as normal. The patch in question is PHNE_19936. However, this patch requires a line adding to the /sbin/rc2.d/S800net file after the line

NETSTAT_DATA=/var/adm/netstat_data

What I need to add into the line below is

/usr/contrib/bin/nettune -s tcp_fin_wait_timer 675

Does anyone have the best way to do this or any examples of perhaps, sed I could use to perform this.

One this is done, I was thinking of running a quick check on the file, say a grep verifying the line is there. I was then going to install the patch and then let the system re boot as normal in the backup schedule.

Has anyone ever done this as part of the reboot or perhaps added something to cron which has done a similar things.

Any suggestion would be greatly appreciated.

Thanks
Paul
Argh ye land lovers !
10 REPLIES 10
John Palmer
Honored Contributor

Re: Installing patches at re boot

Hi,

I believe that this patch gives you the ability to set the fin_wait_timer value.

Rather than amend /sbin/init.d/net, why don't you create your own startup script that runs nettune. You can install this on all the servers so that it runs on next reboot. If the patch isn't installed, the script will just write an error mesage to /etc/rc.log.
An example script...

#!/sbin/sh
#
# Script to configure the network:-
#
PATH=/usr/sbin:/usr/bin:/sbin
export PATH

case $1 in
start)
ERR=""
if [[ -x /usr/contrib/bin/nettune ]];
then /usr/contrib/bin/nettune -s tcp_fin_wait_timer 675
if [[ $? != 0 ]];
then echo "nettune failed!"
ERR=true
fi
else echo "/usr/contrib/bin/nettune not executable!"
ERR=true
fi

if [[ -z ${ERR} ]];
then exit 0
else exit 1
fi ;;
start_msg) echo "network tailoring.";;
*) print "Usage: $0 {start|start_msg}"
exit 1;;
esac
exit 0


Put this script in /sbin/init.d and a soft link to it called S???xxxx in /sbin/rc2.d (??? is a number and xxxx a name that you choose).

Regards,
John
Paul Thomson_2
Super Advisor

Re: Installing patches at re boot

John

Hi, thanks for reply. The issue I have is that in order to get downtime on over 200 servers is a little difficult, hence why I wanted to simply add the line to the net startup file and then issue a install on the patch.

For example
swinstall -x autoreboot=true -x match_target=true -s /tmp/PHNE_19936/depot

This would then reboot the server as part of the weekly downtime we have organised and would then save me speaking to 200 offices to arrange downtime !!! Hence my query on the use of sed to perhaps update the net file.

Argh ye land lovers !
John Palmer
Honored Contributor

Re: Installing patches at re boot

Well if you really want to modify 'net' in a script, you could use ex...

ex net << EOD
/NETSTAT_DATA=
/^$
s;^;/usr/contrib/bin/nettune -s tcp_fin_wait_timer 675
wq!
EOD

Regards,
John
harry d brown jr
Honored Contributor

Re: Installing patches at re boot


Paul,

WHy not just push a new /sbin/rc2.d/S800net file before you do your swinstall??

rcp new_S800net remotehost:/sbin/rc2.d/S800net

live free or die
harry
Live Free or Die
Paul Thomson_2
Super Advisor

Re: Installing patches at re boot

John

So by running in a script

ex net << EOD
/NETSTAT_DATA=
/^$
s;^;/usr/contrib/bin/nettune -s tcp_fin_wait_timer 675
wq!
EOD

This would basically use ex and then amend my net file.

Should the top line include the full path of the netfile I wish to amend ?
For instance
ex /sbin/rc2.d/S800net << EOD

Also the /NETSTAT_DATA=
When I try running the script as above, or amendments to the full path, the message displayed is.

Pattern not found

Does this refer to the line NETSTAT_DATA=

I was wondering if this should read

NETSTAT_DATA=/var/adm/netstat_data
THis being the full line in the file ?

However if I try this, it reports

var: Not an editor command

Could I substitue anything in this line, such as a ' or a " to allow for the full line to be resolved

Teh next stage seems clear as the line is substitued under the NETSTAT line.

Argh ye land lovers !
John Palmer
Honored Contributor

Re: Installing patches at re boot

Yes, you need the full path to the file.

/NETSTAT_DATA=
works on my copy of 'net'. ex doesn't like the full line because it contains '/' characters

Regards,
John
Trond Haugen
Honored Contributor

Re: Installing patches at re boot

Given that you have found a way to add your line to the start-up script. Your next step is to install the patch instead of doing a reboot as the patch will take care of that. That is IF that installation succeeds. Doing a reboot at regular intervals gives good confidence that the system should boot without any problems. But installing the patch will rebuild the kernel and there is always a possibility that something could go wrong. My philosophy is to prepare for that. So someone should check if the system comes up OK, and someone locally should be prepared if it don't.

Regards,
Trond
Regards,
Trond Haugen
LinkedIn
Paul Thomson_2
Super Advisor

Re: Installing patches at re boot

John

My script should read ?

ex /sbin/rc2.d/S340net << EOD
/NETSTAT_DATA=
/^$
s;^;/usr/contrib/bin/nettune -s tcp_fin_wait_timer 675
wq!
EOD

If when running this, I receive

NETSTAT_DATA=/var/adm/netstat_data
Pattern not found

Any ideas ?
Also, thankyou for your assistance so far
Argh ye land lovers !
John Palmer
Honored Contributor

Re: Installing patches at re boot

The /^$ searches for the next blank line, my net script had a blank line immediately following
NETSTAT_DATA=/var/adm/netstat_data

and I used this to insert the nettune command.

Regards,
John
Paul Thomson_2
Super Advisor

Re: Installing patches at re boot

John, thanks for your help.

I have now got this working.

Made the script as follows.

ex /home/H089AHE/S340net << EOD
/NETSTAT_DATA=
/^$
s;^;/usr/contrib/bin/nettune -s tcp_fin_wait_timer 675

wq!
EOD

Thankss again.
Argh ye land lovers !