Operating System - HP-UX
1832566 Members
5605 Online
110043 Solutions
New Discussion

Re: auto control of packages on node reboot

 
Richard Woolley
Frequent Advisor

auto control of packages on node reboot

does anyone know how to do the following:
I want to cron an auto reboot of some of my systems in the cluster. However I would like the current pkgs run on the node to halt when the shutdown starts then re-run on the same node when it comes back into the cluster and registers itself.

so far ive already started on my own script.
do i carry on with it, or can i achieve this some other (easier) way?

As you can see i only want the pks to come down after 7pm. Just in case 1 node isnt running a pkg and i want to reboot it in the day and i cant put "cmhaltpkg (pkgname)" in the /sbin/rc2.d/K001pkg_halt link.
4 REPLIES 4
Frederic Sevestre
Honored Contributor

Re: auto control of packages on node reboot

Hi Mark,

You can control the pakages from an other node of your cluster. For example, if you want to reboot node A, running pkgA.

From node B at reboot time :

cmhaltpkg pkgA
cmhaltnode nodeA
remsh nodeA /usr/sbin/shutdown ....
then wait for node A to be back (using a loop with a ping nodeA -n 1 for example)
then when it is ok
cmrunpkg -n nodeA pkgA

Regards,
Fr??d??ric


Crime doesn't pay...does that mean that my job is a crime ?
Richard Woolley
Frequent Advisor

Re: auto control of packages on node reboot

sounds like a good idea, i'll give it a shot in a couple of nights :)
Chris Garman
Frequent Advisor

Re: auto control of packages on node reboot

Hi,

The way I would recommend doing this is to disable the package from starting on every node except the one you are going to reboot.

cmmodpkg -d -n

When the server shuts down it will halt the package on itself. The package switch parameter (or auto run as they now call it) will still be enabled, but the only server allowed to run it will be the one that is stopping. Therefore as soon as the server is available again the package will restart on that node.

Then enable the package to run on all the other nodes again.

This will ensure the package is down for the shortest time possible, if thats important.

BTW are you the Mark I met at Grahams christmas party?

Chris Garman
PSL
Rita C Workman
Honored Contributor

Re: auto control of packages on node reboot

I have read your question..so let's hope my mind is understanding.
First, I know it's your decision, but why cron a reboot? I have boxes that have been up for months and still don't need a reboot (until I get around to loaded a few patches maybe). But like I said that's your call.

To the real question....

Yes you can do the cmmodpkg -d to disable the pkg from failing over.. and this way you would control manually where/what it runs on.
Now for the halting of the package....
...in your package control script there is a section for defined_run_commands and defined_halt_commands. On ours (running Oracle) we put the line to run our Oracle_start_script and Oracle_stop_script respectively. Now when you bring down the system it will shutdown the packages via your /sbin/init.d/rc* instructions, this will cause your shutdown to hang for a bit while it does this...but it should bring the package down...and then when the system restarts the /sbin/init.d/rc.* will start it all (and pkg) back up.
Now if you run a cmhaltpkg before you do the reboot than when you bring the server backup the package will NOT start because the last flag set in cmcluster instructions showed halt...so halted it remains, so you now must manually again have to run cmrunpkg

So....how's this for a quick sum up...
If your pkg control script has the auto_start and auto_stop set up in this script...then just disable package failover (cmmodpkg -d ...) and reboot the box...

At least (so far) this has worked for me..
Rgrds,
Rit