On AIX HA clusters (and probably other clusters also) when a node fails, the other node (in a two node cluster) take over the failed node's hostname, IP, etc. If you have a cron job, for example, that needs to run on a particular node, regardless of its state, the easiest way that I have found is to do a 'netstat -i' and grep for the node name. For example, I have a script I want to run every hour on node1. I make a crontab entry on both (or all) nodes in the cluster to run this script every hour. Node2 will start to run the script, encounter the HA check and exit. If node1 fails, node2 will take-over node1's name and IP, therefore the HA check will suceed because it now has node1's name and IP also.
sub HA_Check { @NETSTAT = split(' ', `netstat -i | grep node1`, 9999); if ($NETSTAT[3] !~ /node1/) { die; } }

In reply to HA node check by coec

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.